Table of Contents

Raspberry Pi - GPIO Control

Sense-Hat - Definitive Guide

Resources

HUMIDITY & TEMPERATURE MONITOR

DHT11 Image

INFRARED REMOTE CONTROL

Google API & Service Account

PCF8591 ADC DAC AD/DA Analog Digital Converter Module

Raspberry pi PCF8591 Module
SDA SDA
SCL SCL
3V3 VCC
GND GND

XC-4486 5V-3V Logic Level Converter

LLC Board

All of these ‘RX’, ‘RXI’, ‘RXO’, and even ‘RX0’ labels can get confusing. Remember ‘I’ stands for Input and ‘O’ stands for Output. If the Electric Imp sends a signal out of it’s ‘TX’ pin it’ll go into the ‘TXI’ pin on the LLC, get shifted up to 5V and come out the ‘TXO’ pin, and finally run into ‘RX’ on the Arduino. Source: XC-4486 Logic level converter

74hc245 8Ch Logic Converter

Motor Library

ULN2003 28BYJ-U48

To rotate the stepper motor you provide a sequence of “high” and “low” levels to each of the 4 inputs in sequence. By setting the correct sequence of high and low levels the motor spindle will rotate. Reversing the sequence results in the direction being reversed. Note the jumper is only used to isolate the motor - leave jumper 'on' even when using external 5-12V to motor).

Using the pigpio python _stepper module:

L298N Dual DC or Single Stepper Motor Module

The board contains an L298N mounted on a heatsink, a 5 volt voltage regulator to “optionally) provide power for logic circuits, supporting diodes and capacitors and connectors as follows:

You’ll notice that the board also has a number of jumpers. Most of the time you will leave them in place, with the exception of one. They are as follows:

The board has four input terminals plus two enable terminals. You will use these terminals to control both direction and speed or each motor. They are as follows:

Image: WIRINGPI PINOUT

WiringPi GPIO PinoutBCM WiringPi GPIO Pinout

BRAINBOX YOUNG CODERS (bbpi server)

Here is some information about how to use the Raspberry Pi server to control the Internet Of Things:

Some examples of 'things' to connect

Using the information supplied below, create your own web page and add code that can control the remote 'things' (devices and multimedia content) via the Internet.

To create links to 'things' is like finding the route through a maze: you need to start at the beginning and 'join the dots' that take you on a clear path to the end of the maze. Yoiu can figure out how to join the dots by using a table, such as Table 1. below. When used this way, you are starting to learn about some very useful things that are more commonly known as Truth Tables

For example, start by 'joining the dots' (creating a valid URI) to the correct site name, server name, switch type and the switch action:

The Information You Will Need To 'Join The Dots'

Name Location Switch type Pin/device number/id Valid actions
Relay 01 gpio 1) 3 - - flip
Relay 02 gpio 5 - - flip
Button 1 gpio 7 - - click
Button 2 gpio 8 - - click
Switch 1 rf 2) switch_01 on off -
Switch 2 rf switch_02 on off -
Sound 01 files 3) sound-01.mp3
Video 01 files 4) video-01.mp4

To control a remote device:

You must create a link to 'join the dots' by using forward slashes “/” to join each part together to make a link from your browser to the remote device:

For example:

  1. To turn Relay 01 on/off from within school: http://10.145.169.17//gpio/5/flip
  2. To turn Relay 02 on/off from within school: http://10.145.169.17//gpio/5/flip
  3. To turn Switch 2 on from within school: http://10.145.169.17//switch_02/on
  4. To press Button 1 2 from within school: http://10.145.169.17//gpio/7/click

You don't need to know this but it may help -see information about:

To play a remote sound:

You must create a link to 'join the dots' by using forward slashes “/” to join each part together to make a link from your browser to the remote device. You must also place your link within the correct HTML5 multimedia tags.

This is some example HTML5 code that you may add to your web page to create a link to play a remote sound:

<audio controls>
<source
    src="http://flipster.tv/34sfiles/sound01.mp3"
    type="audio/mpeg">
</audio>

To play a remote video:

And here is some example HTML5 code that you may add to your web page to create a link to play a remote video:

<video
    src='http://flipster.tv/34sfiles/video-01.mp4'
    type='video/mp4' width'210' height='210' controls>
</video>

Here are two working example of files that include the above code: - Play remote sound - Play remote video

Also, see WC3 Schools HTML5 video and HTML5 audio coding tutorials.

NOTE: It may take a few seconds for a sound and/or video link to appear in the page…! If the link(s) fail(s) to appear after one minute, try refreshing your web page.


See the introductory and advanced HTML coding information and examples for more help.

To View Remote Video

Raspberry Pi SENSE HAT

SYNOPSIS

How to use a Raspberry Pi and on-line 3D emulator to create code and devices to solve problems and explore the possibilities of the Internet Of Things. A practical guide for primary school students and teachers with links to projects, lesson plans and resources.


The Raspberry Pi Sense Hat (Hardware Attached on TOP), is one of many push-on additions for the Raspberry Pi - a small affordable computer that kids can use to program and control the Internet Of Things (IOT).

Google AIY Edu Kit The Raspberry Pi Foundation supports on-going education projects developed and supported by Cambridge University, Google, NASA, the UK Education Department and many others.

Writing programs for the Sense HAT is powerful but simple to do. Coding is fast and easy using fully integrated Python libraries.

Others Raspberry Pi supporters/partners, such as Google, are constantly developing education-based add-ons such as the recently released (April 2018) DIY kits for AI voice & vision w/edu focus.

Also check out the AstroPi website, for many more ideas and education resources.


Video: Sense Hat (Astro Pi) On-board the ISS


On-Line Raspberry Pi Interactive 3D Emulator

Image: Trinket - On-line Coding Emulator

Trinket is a browser-based, an all-in-one coding environment designed for education. Teachers and students use trinket to code during class.

Every student will have access access to their own, personal Trinket Sense-Hat Emulator. To enable 24/7 access from anywhere, students may create a free account on the Trinket website to save their work.

Trinket - Sense Hat EmulatorDesktop Sense-emu


In case you do not want to use an internet-based emulator, there is an optional free desktop version.

Code written in the emulator is directly portable to a physical Raspberry Pi and Sense HAT without modification. This means students can now develop and test programs using the movement sensors from any internet-connected computer, anywhere in the world.


IRF 540 module - 4 Channel Opto Isolated DC Switch

MOSFET's have good switching characteristics and are widely used to control almost any DC load. This 4 channel IRF540 MOSFET is perfect for switching DC loads up to 10A. The module is optoisolated - note that the GROUND connections are in common so there is not complete isolation. The module is basically a “Solid-State Relay” for DC. Up to 4 individually controllable loads may be connected to the (+) and (-) switched outputs, all fed from a common power rail. Being a low side switch, when the switch is on, it connects the load (-) terminal to ground.


Transmit Infrared without LIRC


TCPDump Cheat Sheet


Getting Started

The Raspberry Pi Foundation is a UK-based charity that works to put the power of digital making into the hands of people all over the world. The Foundation provides low-cost, high-performance computers that people use to learn, solve problems and have fun. We provide outreach and education to help more people access computing and digital making. We develop free resources to help people learn about computing and how to make things with computers, and train educators who can guide other people to learn.

In this project, you will learn how to control the Sense HAT’s LED matrix and collect sensor data, and you will combine these ideas in a number of small projects. What you will learn

By following this resource with your Raspberry Pi and Sense HAT you will learn how to:

  1. Communicate with the Sense HAT using Python
  2. Access the outputs of the Sense HAT
  3. Program the inputs of the Sense HAT
  4. Use the Sense HAT library to display messages and images
  5. Use variables to store sensor data
  6. Use loops to repeat behaviours

For detailed technical reference, see example command-line scripts, API docs and hardware pinout.

Here is an introduction video and/or a more advanced video created by IBM for it's in-house developers as an introduction to the Internet Of Things [IoT] and provides access to free IBM on-line course.

For experts, it is possible to reclaim GPIO's and add extra devices with the Sense-Hat installed. IMPORTANT: Later versions of sense-hat may use additional pins. Check first!

Pi Projects With Python

A collection of authentic, detailed, step-by-step procedures and resources designed for kids.

Some great projects that will help you start writing code and get going with digital making:

Also, there are free training programmes available for educators. We have a strong support community who can help educators with support for training and events such as set up coding dojos at your school.

Hardware Installation

  1. Connect the Sense HAT to the Raspberry Pi via the 40 pin GPIO socket
  2. Open up a terminal window on the Raspberry Pi and run the following command:
apt-get install sense-hat

This will take between 2 - 5 minutes to run on Raspberry Pi 2 or later hardware, and up to 20 minutes on early models)

When the install is finished you will need to reboot your Raspberry Pi

Note: The Raspberry Pi Sense HAT is compatible with the Raspberry Pi 3, Raspberry Pi 2, Model B+, and Model A+, but NOT the earlier 26-pin models of Raspberry Pi 1 Model B & A's. For more detal, view the technical documentation and specifications.

27Mhz 40Mhz RC Controller

TX-2B / RX-2B From Silan Semiconductors, is a 5V CMOS remote encoder decoder pair that can be used for remote control applications. TX-2B / RX-2B has five channels, wide operating voltage range (from 1.5V to 5V), low stand-by current (around 10uA), low operating current (2mA), auto power off function and requires few external components. The TX-2B / RX-2B was originally designed for remote toy car applications, but they can be used for any kind of remote switching application.

pi-rc is a program that turns your Raspberry Pi into a radio controller for RC cars without any additional hardware. With it, you should be able to drive just about any cheap toy-grade RC car programmatically with your Raspberry Pi.

10.145.169.17 34spi.example.org
10.145.169.18 bbcpi.example.org
172.16.1.11 xypi.example.org

=======================================
START: Tue Apr 17 10:04:23 2018
=======================================
MATRIX:
Pads: GPIO2   INPUT   PUD_UP
Pads: GPIO3   INPUT   PUD_UP
Pads: GPIO4   INPUT   PUD_UP

Pads: GPIO7   INPUT   PUD_DOWN
Pads: GPIO8   INPUT   PUD_DOWN
Pads: GPIO9   INPUT   PUD_DOWN
Pads: GPIO10  INPUT   PUD_DOWN

Cols: GPIO11  INPUT   PUD_DOWN
Cols: GPIO14  INPUT   PUD_DOWN
Cols: GPIO15  INPUT   PUD_DOWN
Cols: GPIO22  INPUT   PUD_DOWN

Rows: GPIO23  INPUT   PUD_DOWN
Rows: GPIO24  INPUT   PUD_DOWN
Rows: GPIO25  INPUT   PUD_DOWN
Rows: GPIO27  INPUT   PUD_DOWN
=======================================
NON-MATRIX PADS
Snd:cb1   GPIO_2  p3  sfx_callback_1
Snd:cb2   GPIO_3  p5  sfx_callback_2

Row:cb3   GPIO_4  p7  sfx_callback_3
Row:cb4   GPIO14  p8  sfx_callback_4
Row:cb5   GPIO15  p10 sfx_callback_5
Row:cb6   GPIO18  p12 sfx_callback_6

Col:cb7   GPIO27  p13 sfx_callback_7
Col:cb8   GPIO22  p15 sfx_callback_8
Col:cb9   GPIO23  p16 sfx_callback_9
Col:cb10  GPIO24  p18 sfx_callback_10

Snd:cb11  GPIO10  p19 sfx_callback_11
Snd:cb12  GPIO_9  p21 sfx_callback_12
Snd:cb13  GPIO11  p23 sfx_callback_13

Rly14:cb14 GPIO25  p22 sfx_callback_14
Rly15:cb15 GPIO_8  p24 sfx_callback_15
Rly16:cb16 GPIO_7  p26 sfx_callback_16
1)
RaspberryPi GPIO
2)
Radio Frequency switch
3) , 4)
see example HTML5 code below