https://bitwizard.nl/wiki/api.php?action=feedcontributions&user=Rijk&feedformat=atomBitWizard WIKI - User contributions [en]2024-03-19T04:36:32ZUser contributionsMediaWiki 1.27.0https://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2934Raspberry Relay2014-08-27T14:34:34Z<p>Rijk: /* Usage */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
The Raspberry Relay board makes it possible to control 4 relays using your Raspberry Pi. It can be found in the shop [http://www.bitwizard.nl/shop/raspberry-pi/rpi-relay here].<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs. If you power your Raspberry Pi with batteries, it is recommended to use the regular power connector, since a short-circuit could damage the battery. The positive side of bypassing the polyfuse is that the board is less sensitive to voltage fluctuations, since the polyfuse induces a 0.2V voltage drop.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a relay output pin.<br />
<br />
[[File:Dsc05646_small.jpg|thumb|300px|Example configuration]]<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number (by [http://elinux.org/File:RPi_P1_header.png this] scheme)!! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2933Raspberry Relay2014-08-27T14:23:04Z<p>Rijk: /* Pinout */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
The Raspberry Relay board makes it possible to control 4 relays using your Raspberry Pi. It can be found in the shop [http://www.bitwizard.nl/shop/raspberry-pi/rpi-relay here].<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs. If you power your Raspberry Pi with batteries, it is recommended to use the regular power connector, since a short-circuit could damage the battery. The positive side of bypassing the polyfuse is that the board is less sensitive to voltage fluctuations, since the polyfuse induces a 0.2V voltage drop.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a relay output pin.<br />
<br />
[[File:Dsc05646_small.jpg|thumb|300px|Example configuration]]<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=File:Dsc05646_small.jpg&diff=2932File:Dsc05646 small.jpg2014-08-27T14:22:22Z<p>Rijk: </p>
<hr />
<div></div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2931Raspberry Relay2014-08-27T13:44:19Z<p>Rijk: /* Overview */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
The Raspberry Relay board makes it possible to control 4 relays using your Raspberry Pi. It can be found in the shop [http://www.bitwizard.nl/shop/raspberry-pi/rpi-relay here].<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs. If you power your Raspberry Pi with batteries, it is recommended to use the regular power connector, since a short-circuit could damage the battery. The positive side of bypassing the polyfuse is that the board is less sensitive to voltage fluctuations, since the polyfuse induces a 0.2V voltage drop.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a relay output pin.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2930Raspberry Relay2014-08-27T13:33:22Z<p>Rijk: </p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
The Raspberry Relay board makes it possible to control 4 relays using your Raspberry Pi. It can be found in the shop [http://www.bitwizard.nl/shop/raspberry-pi/rpi-relay here].<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a relay output pin.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Usbio_ACM_sample_program&diff=2929Usbio ACM sample program2014-08-27T12:47:53Z<p>Rijk: </p>
<hr />
<div>== USBIO sample ACM program ==<br />
<br />
The sample ACM program can already be quite useful. It creates an ACM device on the USB bus where you can communicate with the AVR on the board. <br />
<br />
Under Linux if you connect your usbio board when it is loaded with this program, you will get a /dev/ttyACM0 device. <br />
<br />
Under windows you will have to follow the directions of the LUFA documentation which include downloading and using the INF file located: https://code.google.com/p/lufa-lib/source/browse/trunk/Demos/Device/LowLevel/VirtualSerial/LUFA%20VirtualSerial.inf?r=1607<br />
<br />
The LUFA explanation is here: http://code.google.com/p/lufa-lib/source/browse/trunk/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt?spec=svn1470&r=1470<br />
<br />
Once you have the driver sorted, you can use any terminal program you like to connect with the board. I use "kermit" to communicate with serial devices like this. There are several other programs available, but I'm used to kermit. Under windows there is a program called hyperterm. <br />
<br />
Once you connect to the device, you will be prompted with a welcome string and a prompt. You can use several commands: <br />
<br />
=== s ===<br />
if you type s<outputnumber> the output with that number will go high. Outputnumber is in hex. For usbio the output numbers go from 0 to f. For example s5 will turn on output 5. <br />
<br />
=== c ===<br />
if you type c<outputnumber> the output with that number will be cleared. For example: ce will clear output 14 (which is e in hex). <br />
=== a ===<br />
If you type a<output> <value> the output will be put in software pwm mode. Currently values 0...80 are supported (128 levels). <br />
=== p === <br />
If you type p <output> <length> the output with that number will be pulsed for <length> ms. The length is of course in hex. <br />
=== z ===<br />
If you type "z" the board will reset into firmware-upload-mode.<br />
<br />
== download ==<br />
<br />
You can download the source from: http://www.bitwizard.nl/software/usbio.tgz<br />
<br />
You then need to download LUFA, and place it in the directory usbio/../LUFA (i.e. next to the usbio directory).<br />
<br />
== future enhancements ==<br />
<br />
In the future we'll enhance the program to allow setting the mode of pins to inputs. And the program should be able to monitor the inputs value, and report the state changes as they happen. Also on-demand questioning of the inputs should become possible.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Main_Page&diff=2928Main Page2014-08-27T12:47:23Z<p>Rijk: /* Board specific pages */</p>
<hr />
<div><big>'''BitWizard documentation wiki.'''</big><br />
<br />
This WIKI is for documentation of the BitWizard SPI/I2C expansion system and other boards, available from the [http://www.bitwizard.nl/catalog/ BitWizard Shop]. If you are considering adding information that is not related to one of our products, please contact us beforehand.<br><br />
It is expressly forbidden to add information intended to promote other sites. It is expressly forbidden to have a program add accounts and add articles with links to other sites. <br />
<br />
= How-to's =<br />
* [[Beginners guide to SPI on Raspberry Pi]]<br />
* [[installing and booting FriendlyArm mini6410]]<br />
<br />
= Kits =<br />
* [[RGB clock]]<br />
* [[Raspberry Pi camera extension kit]]<br />
<br />
<br />
= Developement boards =<br />
* [[Raspduino]]<br />
* [[FTDI_ATmega]]<br />
* [[USB-multio]]<br />
* [[usbbigmultio]]<br />
* [[Cyclone dev board]]<br />
<br />
= Expansion boards =<br />
<br />
== General ==<br />
* [[Default addresses]] (both SPI and I2C)<br />
* [[SPI versus I2C protocols]]<br />
* [[Daisy-chaining BitWizard I2C boards]]<br />
* [[USB Relay]]<br />
* [[Model B+ compatibility]]<br />
<br />
== Board specific pages ==<br />
These expansion boards come in I2C and SPI versions, and thus can be connected to a single bus. This allows you to easily expand your microcontroller system with new functions, without the cost of additional I/O pins.<br />
<br />
* [[LCD|LCD]]<br />
* [[DIO|DIO]]<br />
* [[Servo|Servo]]<br />
* [[7FETs|7FETs]]<br />
* [[3FETs|3FETs]]<br />
* [[temp|Temperature Interface]]<br />
* [[relay|Relay/BigRelay]]<br />
* [[motor|motor]]<br />
<!--<br />
* [[PiPower|PiPower]]<br />
--><br />
* [[Raspberry Juice]]<br />
* [[Raspberry Relay]]<br />
* [[User Interface|User Interface]]<br />
* [[7_Segment]]<br />
<!--<br />
* [[SPI_SPI]]<br />
--><br />
* [[pushbutton]]<br />
* [[rtc]]<br />
* [[Dimmer]]<br />
* [[16 LEDs]]<br />
<br />
== Other boards ==<br />
* [[USB-SATA powerswitch]]<br />
* [[USB-opto]]<br />
* [[Servotester]]<br />
<!--<br />
* [[USB relay board]]<br />
--><br />
<br />
== Breakout boards ==<br />
* [[FT245RL breakout board]]<br />
* [[FT2232H breakout board]]<br />
* [[Raspberry Pi Serial]]<br />
* [[FTDI serial]]<br />
* [[FTDI serial 2]]<br />
<br />
== I2C chips ==<br />
* [[I2C DAC|Dual MCP4726 DAC]]<br />
* [[I2C ADC|MCP3424 ADC]]<br />
* [[I2C splitter|PCA9548A I2C switch/mux]]<br />
* [[IO Expander|MCP23008 IO Expander]]<br />
<br />
== SPI chips ==<br />
* [[IO Expander|MCP23S08 IO Expander]]<br />
* [[SPI DAC|MCP4822 DAC]]<br />
<br />
= Sample programs =<br />
* [[Usbio kitt]]<br />
* [[Usbio ACM sample program]]<br />
* [[Raspberry Pi LCD program]]<br />
<!--<br />
= Preparing your development environment =<br />
* [[Linux]]<br />
* [[Windows]]<br />
* [[MacOS]]<br />
--><br />
= Sample projects =<br />
* [[temperature control]] (ftdi_atmega, spi_temp, spi_relay).<br />
<br />
= Raspberry Pi projects =<br />
* [[Reducing power consumption of a raspberry Pi]]<br />
* [[LCD + 3FETs demonstration|Connecting two 1602 LCDs and an RGB LED Strip to a Raspberry Pi]]<br />
* [[Connecting a motor and 1602 LCD to a Raspberry Pi]]<br />
* [[MPU-6050 sensor connected to Raspberry Pi]]<br />
* [[raspberry pi expansion system page]]<br />
* [[GPS reciever connected to Raspberry Pi]]<br />
<br />
<br />
= Help! =<br />
<br />
If you have trouble finding things on this wiki you can: <br />
* use the search function on the left<br />
* send us an email<br />
* or use the forum: http://forum.bitwizard.nl/ <br />
<br />
<br />
= Miscellaneous =<br />
* [[Solder jumpers]]<br />
* [[SPI_connector_pinout]]<br />
* [[template]]<br />
* [[Nikon D80 wired remote]]<br />
* [[Iphone 3GS camera]]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Temperature_Interface&diff=2927Temperature Interface2014-08-27T12:41:58Z<p>Rijk: /* Assembly instructions */</p>
<hr />
<div>[[File:Tempic.jpg|thumb|300px|alt=Temperature Interface|Temperature Interface]]<br />
<br />
This is the documentation page for the Temperature Interface<br />
== Overview ==<br />
<br />
This board enables you to measure up to 4 analog signals, specifically configured for measuring temperature with an MCP9700 sensor (or LM35 if you only require above-freezing temperatures). <br />
<br />
== Assembly instructions ==<br />
<br />
None: the board comes fully assembled. The orientation of your sensor is indicated on the board, if you use the recommended MCP9700. We suggest you first test with the MCP9700 directly inserted into the socket in the board, before you make an extension cord to put it where you want to measure the temperature.<br />
<br />
Officially electronics should easily be able to handle temperatures of about 80 °C, so it should be possible to put the whole module where you want to measure. I'd try try to avoid that situation. <br />
<br />
=== Possible Configurations ===<br />
<br />
with MCP9700 or LM35. If you know of other sensors that provide a similar signal, let us know.<br />
<br />
== External resources ==<br />
<br />
=== Datasheets ===<br />
* MCP9700: http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf<br />
* LM35: http://www.ti.com/lit/ds/symlink/lm35.pdf<br />
<br />
== Additional software ==<br />
<br />
<br />
=== Related projects ===<br />
<br />
This is a simplified version of the "DIO", but with a more convenient pinout for its purpose. We've taken out the features that cannot be used anyway on this board, like stepper motor control. <br />
<br />
== Pinout ==<br />
<br />
Each of the four temperature connectors has: <br />
<br />
* 1 VCC<br />
* 2 signal<br />
* 3 GND<br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
<br />
=== LEDs ===<br />
<br />
There is one power-led.<br />
<br />
== Jumper settings ==<br />
<br />
There is one solder jumper that would allow you to configure the second SPI port as a programming connector for software development. <br />
<br />
== Protocol ==<br />
For the intro to the SPI and I2C protocols read: [[SPI versus I2C protocols]]<br />
<br />
The board specific protocol can be found here: [[DIO_protocol]] The STEPPER, BUTTONS and PWM functions are not implemented on "temp". <br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
You should also read the [[General_SPI_protocol]] notes.<br />
<br><br />
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at [http://www.bitwizard.nl/software the BitWizard software download directory] .<br><br />
<br><br />
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the DIO and TEMP boards as well.<br><br />
<br />
== accuracy ==<br />
<br />
The sensors claim a +/- 1 or +/- 2 degree accuracy. But the system adds a few more uncertainties. For example, the "internal 1.1V reference" is officially +/- 10%. In practise we've measured it way closer to 1.1 than the range would suggest, but it is a possible source of errors. Similarly, the analog amplifier has an offset voltage that contributes to the overall error. <br />
<br />
In practise we often see an error on the order of 5 degrees C too high compared to the ideal temperature reading. We suggest you calibrate at least the offset by doing a reference measurement with a thermometer that you trust. Best would be to electrically insulate the sensor and put it in melting water (0C), and then in boiling water (100C). That way you can calibrate both the offset and gain.<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Temperature_Interface&diff=2926Temperature Interface2014-08-27T12:39:49Z<p>Rijk: </p>
<hr />
<div>[[File:Tempic.jpg|thumb|300px|alt=Temperature Interface|Temperature Interface]]<br />
<br />
This is the documentation page for the Temperature Interface<br />
== Overview ==<br />
<br />
This board enables you to measure up to 4 analog signals, specifically configured for measuring temperature with an MCP9700 sensor (or LM35 if you only require above-freezing temperatures). <br />
<br />
== Assembly instructions ==<br />
<br />
None: the board comes fully assembled. The orientation of your sensor is indicated on the board, if you use the recommended MCP9700. We suggest you first test with the MCP9700 directly inserted into the socket in the board, before you make an extension cord to put it where you want to measure the temperature.<br />
<br />
Officially electronics should easily be able to handle temperatures of say 80 degrees C, so officially it should be possible to put the whole module where you want to measure. I'd try try to avoid that situation. <br />
<br />
=== Possible Configurations ===<br />
<br />
with MCP9700 or LM35. If you know of other sensors that provide a similar signal, let us know. <br />
<br />
== External resources ==<br />
<br />
=== Datasheets ===<br />
* MCP9700: http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf<br />
* LM35: http://www.ti.com/lit/ds/symlink/lm35.pdf<br />
<br />
== Additional software ==<br />
<br />
<br />
=== Related projects ===<br />
<br />
This is a simplified version of the "DIO", but with a more convenient pinout for its purpose. We've taken out the features that cannot be used anyway on this board, like stepper motor control. <br />
<br />
== Pinout ==<br />
<br />
Each of the four temperature connectors has: <br />
<br />
* 1 VCC<br />
* 2 signal<br />
* 3 GND<br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
<br />
=== LEDs ===<br />
<br />
There is one power-led.<br />
<br />
== Jumper settings ==<br />
<br />
There is one solder jumper that would allow you to configure the second SPI port as a programming connector for software development. <br />
<br />
== Protocol ==<br />
For the intro to the SPI and I2C protocols read: [[SPI versus I2C protocols]]<br />
<br />
The board specific protocol can be found here: [[DIO_protocol]] The STEPPER, BUTTONS and PWM functions are not implemented on "temp". <br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
You should also read the [[General_SPI_protocol]] notes.<br />
<br><br />
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at [http://www.bitwizard.nl/software the BitWizard software download directory] .<br><br />
<br><br />
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the DIO and TEMP boards as well.<br><br />
<br />
== accuracy ==<br />
<br />
The sensors claim a +/- 1 or +/- 2 degree accuracy. But the system adds a few more uncertainties. For example, the "internal 1.1V reference" is officially +/- 10%. In practise we've measured it way closer to 1.1 than the range would suggest, but it is a possible source of errors. Similarly, the analog amplifier has an offset voltage that contributes to the overall error. <br />
<br />
In practise we often see an error on the order of 5 degrees C too high compared to the ideal temperature reading. We suggest you calibrate at least the offset by doing a reference measurement with a thermometer that you trust. Best would be to electrically insulate the sensor and put it in melting water (0C), and then in boiling water (100C). That way you can calibrate both the offset and gain.<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=File:Tempic.jpg&diff=2925File:Tempic.jpg2014-08-27T12:38:36Z<p>Rijk: </p>
<hr />
<div></div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Temperature_Interface&diff=2923Temperature Interface2014-08-27T12:33:14Z<p>Rijk: moved Temp to Temperature Interface</p>
<hr />
<div>[[File:.jpg|thumb|300px|alt=|]]<br />
<br />
This is the documentation page for the Temperature Interface<br />
== Overview ==<br />
<br />
This board enables you to measure up to 4 analog signals, specifically configured for measuring temperature with an MCP9700 sensor (or LM35 if you only require above-freezing temperatures). <br />
<br />
== Assembly instructions ==<br />
<br />
None: the board comes fully assembled. The orientation of your sensor is indicated on the board, if you use the recommended MCP9700. We suggest you first test with the MCP9700 directly inserted into the socket in the board, before you make an extension cord to put it where you want to measure the temperature.<br />
<br />
Officially electronics should easily be able to handle temperatures of say 80 degrees C, so officially it should be possible to put the whole module where you want to measure. I'd try try to avoid that situation. <br />
<br />
=== Possible Configurations ===<br />
<br />
with MCP9700 or LM35. If you know of other sensors that provide a similar signal, let us know. <br />
<br />
== External resources ==<br />
<br />
=== Datasheets ===<br />
* MCP9700: http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf<br />
* LM35: http://www.ti.com/lit/ds/symlink/lm35.pdf<br />
<br />
== Additional software ==<br />
<br />
<br />
=== Related projects ===<br />
<br />
This is a simplified version of the "DIO", but with a more convenient pinout for its purpose. We've taken out the features that cannot be used anyway on this board, like stepper motor control. <br />
<br />
== Pinout ==<br />
<br />
Each of the four temperature connectors has: <br />
<br />
* 1 VCC<br />
* 2 signal<br />
* 3 GND<br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
<br />
=== LEDs ===<br />
<br />
There is one power-led.<br />
<br />
== Jumper settings ==<br />
<br />
There is one solder jumper that would allow you to configure the second SPI port as a programming connector for software development. <br />
<br />
== Protocol ==<br />
For the intro to the SPI and I2C protocols read: [[SPI versus I2C protocols]]<br />
<br />
The board specific protocol can be found here: [[DIO_protocol]] The STEPPER, BUTTONS and PWM functions are not implemented on "temp". <br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
You should also read the [[General_SPI_protocol]] notes.<br />
<br><br />
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at [http://www.bitwizard.nl/software the BitWizard software download directory] .<br><br />
<br><br />
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the DIO and TEMP boards as well.<br><br />
<br />
== accuracy ==<br />
<br />
The sensors claim a +/- 1 or +/- 2 degree accuracy. But the system adds a few more uncertainties. For example, the "internal 1.1V reference" is officially +/- 10%. In practise we've measured it way closer to 1.1 than the range would suggest, but it is a possible source of errors. Similarly, the analog amplifier has an offset voltage that contributes to the overall error. <br />
<br />
In practise we often see an error on the order of 5 degrees C too high compared to the ideal temperature reading. We suggest you calibrate at least the offset by doing a reference measurement with a thermometer that you trust. Best would be to electrically insulate the sensor and put it in melting water (0C), and then in boiling water (100C). That way you can calibrate both the offset and gain.<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Temp&diff=2924Temp2014-08-27T12:33:14Z<p>Rijk: moved Temp to Temperature Interface</p>
<hr />
<div>#REDIRECT [[Temperature Interface]]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Temperature_Interface&diff=2922Temperature Interface2014-08-27T12:31:00Z<p>Rijk: </p>
<hr />
<div>[[File:.jpg|thumb|300px|alt=|]]<br />
<br />
This is the documentation page for the Temperature Interface<br />
== Overview ==<br />
<br />
This board enables you to measure up to 4 analog signals, specifically configured for measuring temperature with an MCP9700 sensor (or LM35 if you only require above-freezing temperatures). <br />
<br />
== Assembly instructions ==<br />
<br />
None: the board comes fully assembled. The orientation of your sensor is indicated on the board, if you use the recommended MCP9700. We suggest you first test with the MCP9700 directly inserted into the socket in the board, before you make an extension cord to put it where you want to measure the temperature.<br />
<br />
Officially electronics should easily be able to handle temperatures of say 80 degrees C, so officially it should be possible to put the whole module where you want to measure. I'd try try to avoid that situation. <br />
<br />
=== Possible Configurations ===<br />
<br />
with MCP9700 or LM35. If you know of other sensors that provide a similar signal, let us know. <br />
<br />
== External resources ==<br />
<br />
=== Datasheets ===<br />
* MCP9700: http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf<br />
* LM35: http://www.ti.com/lit/ds/symlink/lm35.pdf<br />
<br />
== Additional software ==<br />
<br />
<br />
=== Related projects ===<br />
<br />
This is a simplified version of the "DIO", but with a more convenient pinout for its purpose. We've taken out the features that cannot be used anyway on this board, like stepper motor control. <br />
<br />
== Pinout ==<br />
<br />
Each of the four temperature connectors has: <br />
<br />
* 1 VCC<br />
* 2 signal<br />
* 3 GND<br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
<br />
=== LEDs ===<br />
<br />
There is one power-led.<br />
<br />
== Jumper settings ==<br />
<br />
There is one solder jumper that would allow you to configure the second SPI port as a programming connector for software development. <br />
<br />
== Protocol ==<br />
For the intro to the SPI and I2C protocols read: [[SPI versus I2C protocols]]<br />
<br />
The board specific protocol can be found here: [[DIO_protocol]] The STEPPER, BUTTONS and PWM functions are not implemented on "temp". <br />
<br />
See [[Analog inputs]] for the configuration of the ADC channel you need for each of the connectors. <br />
<br />
You should also read the [[General_SPI_protocol]] notes.<br />
<br><br />
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at [http://www.bitwizard.nl/software the BitWizard software download directory] .<br><br />
<br><br />
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the DIO and TEMP boards as well.<br><br />
<br />
== accuracy ==<br />
<br />
The sensors claim a +/- 1 or +/- 2 degree accuracy. But the system adds a few more uncertainties. For example, the "internal 1.1V reference" is officially +/- 10%. In practise we've measured it way closer to 1.1 than the range would suggest, but it is a possible source of errors. Similarly, the analog amplifier has an offset voltage that contributes to the overall error. <br />
<br />
In practise we often see an error on the order of 5 degrees C too high compared to the ideal temperature reading. We suggest you calibrate at least the offset by doing a reference measurement with a thermometer that you trust. Best would be to electrically insulate the sensor and put it in melting water (0C), and then in boiling water (100C). That way you can calibrate both the offset and gain.<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Main_Page&diff=2921Main Page2014-08-27T12:29:23Z<p>Rijk: /* Board specific pages */</p>
<hr />
<div><big>'''BitWizard documentation wiki.'''</big><br />
<br />
This WIKI is for documentation of the BitWizard SPI/I2C expansion system and other boards, available from the [http://www.bitwizard.nl/catalog/ BitWizard Shop]. If you are considering adding information that is not related to one of our products, please contact us beforehand.<br><br />
It is expressly forbidden to add information intended to promote other sites. It is expressly forbidden to have a program add accounts and add articles with links to other sites. <br />
<br />
= How-to's =<br />
* [[Beginners guide to SPI on Raspberry Pi]]<br />
* [[installing and booting FriendlyArm mini6410]]<br />
<br />
= Kits =<br />
* [[RGB clock]]<br />
* [[Raspberry Pi camera extension kit]]<br />
<br />
<br />
= Developement boards =<br />
* [[Raspduino]]<br />
* [[FTDI_ATmega]]<br />
* [[USB-multio]]<br />
* [[usbbigmultio]]<br />
* [[Cyclone dev board]]<br />
<br />
= Expansion boards =<br />
<br />
== General ==<br />
* [[Default addresses]] (both SPI and I2C)<br />
* [[SPI versus I2C protocols]]<br />
* [[Daisy-chaining BitWizard I2C boards]]<br />
* [[USB Relay]]<br />
* [[Model B+ compatibility]]<br />
<br />
== Board specific pages ==<br />
These expansion boards come in I2C and SPI versions, and thus can be connected to a single bus. This allows you to easily expand your microcontroller system with new functions, without the cost of additional I/O pins.<br />
<br />
* [[LCD|LCD]]<br />
* [[DIO|DIO]]<br />
* [[Servo|Servo]]<br />
* [[7FETs|7FETs]]<br />
* [[3FETs|3FETs]]<br />
* [[temp|temp]]<br />
* [[relay|Relay/BigRelay]]<br />
* [[motor|motor]]<br />
<!--<br />
* [[PiPower|PiPower]]<br />
--><br />
* [[Raspberry Juice]]<br />
* [[Raspberry Relay]]<br />
* [[User Interface|User Interface]]<br />
* [[7_Segment]]<br />
<!--<br />
* [[SPI_SPI]]<br />
--><br />
* [[pushbutton]]<br />
* [[rtc]]<br />
* [[Dimmer]]<br />
* [[16 LEDs]]<br />
<br />
== Other boards ==<br />
* [[USB-SATA powerswitch]]<br />
* [[USB-opto]]<br />
* [[Servotester]]<br />
<!--<br />
* [[USB relay board]]<br />
--><br />
<br />
== Breakout boards ==<br />
* [[FT245RL breakout board]]<br />
* [[FT2232H breakout board]]<br />
* [[Raspberry Pi Serial]]<br />
* [[FTDI serial]]<br />
* [[FTDI serial 2]]<br />
<br />
== I2C chips ==<br />
* [[I2C DAC|Dual MCP4726 DAC]]<br />
* [[I2C ADC|MCP3424 ADC]]<br />
* [[I2C splitter|PCA9548A I2C switch/mux]]<br />
* [[IO Expander|MCP23008 IO Expander]]<br />
<br />
== SPI chips ==<br />
* [[IO Expander|MCP23S08 IO Expander]]<br />
* [[SPI DAC|MCP4822 DAC]]<br />
<br />
= Sample programs =<br />
* [[Usbio kitt]]<br />
* [[Usbio ACM sample program]]<br />
* [[Raspberry Pi LCD program]]<br />
<!--<br />
= Preparing your development environment =<br />
* [[Linux]]<br />
* [[Windows]]<br />
* [[MacOS]]<br />
--><br />
= Sample projects =<br />
* [[temperature control]] (ftdi_atmega, spi_temp, spi_relay).<br />
<br />
= Raspberry Pi projects =<br />
* [[Reducing power consumption of a raspberry Pi]]<br />
* [[LCD + 3FETs demonstration|Connecting two 1602 LCDs and an RGB LED Strip to a Raspberry Pi]]<br />
* [[Connecting a motor and 1602 LCD to a Raspberry Pi]]<br />
* [[MPU-6050 sensor connected to Raspberry Pi]]<br />
* [[raspberry pi expansion system page]]<br />
* [[GPS reciever connected to Raspberry Pi]]<br />
<br />
<br />
= Help! =<br />
<br />
If you have trouble finding things on this wiki you can: <br />
* use the search function on the left<br />
* send us an email<br />
* or use the forum: http://forum.bitwizard.nl/ <br />
<br />
<br />
= Miscellaneous =<br />
* [[Solder jumpers]]<br />
* [[SPI_connector_pinout]]<br />
* [[template]]<br />
* [[Nikon D80 wired remote]]<br />
* [[Iphone 3GS camera]]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Relay&diff=2920Relay2014-08-27T11:49:47Z<p>Rijk: /* Datasheets */</p>
<hr />
<div>[[File:SPI_relay.jpg|thumb|300px|alt=The SPI_relay board|The SPI_relay board]]<br />
[[File:bigrelay.jpg|thumb|300px|alt=The BigRelay board| The BigRelay board]]<br />
This is the documentation page for the I2C/SPI Relay and BigRelay boards. <br />
<br />
== Overview ==<br />
The Relay board allow you to drive two relays, while the BigRelay board can drive six relays. Both of the boards have a I2C and SPI version. <br />
<br />
== Assembly instructions ==<br />
<br />
None: the board comes fully assembled. <br />
<br />
== Protocol == <br />
<br />
To make the relay PCB do things, you need to send things over the SPI bus to the PCB. <br />
<br />
The general overview of the protocol is [[General_SPI_protocol|here]]. <br />
<br />
The specific commands for the relay PCB are explained on the page about the spi_dio board, as the two boards share the same protocol: [[DIO_protocol]] . The address of the BigRelay was incorrectly documented at first. The correct address is 0x9c. <br />
<br />
For Arduino, a sample PDE is available, called ardemo_lcd.pde, also at [http://www.bitwizard.nl/software|the BitWizard software download directory] .<br />
<br />
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the dio and relay boards as well.<br />
<br />
== Jumper settings ==<br />
<br />
The Bigrelay has a jumper on the right side of the board. It is usually marked "SV1". The pinout is as follows:<br />
<br />
* 3 - +5V from SPI/I2C<br />
* 2 - 5V for the relays<br />
* 1 - GND<br />
<br />
This allows you to use the SPI/I2C 5V by installing a jumper on 2-3, or use an external powersupply by connecting the powersupply GND to pin 1 and the 5V from the powersupply to pin 2.<br />
<br />
<br />
== Additional Considerations ==<br />
<br />
Each relay draws about 70mA. This means that if you have the bigrelay board, and turn on all six relays, the current draw will amount to about 400mA. If you have the board connected to a Raspberry Pi, this might stress your polyfuse on the 5V line, and/or exceed the capabilities of your powersupply. You can supply extra 5V power on the 5V lines of other connectors on the board. For example, if you have the SPI version, you can mount one of the I2C connectors and provide GND and 5V on pin 1 and 4 respectively. <br />
<br />
Note that your extra powersupply is likely to start powering the Raspberry Pi a bit as well. (Due to the voltage drop over the polyfuse in the Raspberry Pi, the 5V on the relay board is likely to be a bit higher than that what ends up on the Pi itself.) You could consider powering the whole system through this extra powersupply, but be careful, the polyfuse on the Pi is now circumvented.<br />
<br />
== Default operation ==<br />
<br />
By default the relays will start out in the "off" position. (i.e. a connection between the common and the "normally closed" will be present).<br />
<br />
== Power Consumption ==<br />
<br />
Each relay typically consumes about 55mA. Max 70mA. So for a bigrelay with all relays "on" you need to arrange for about 400mA of power. The board uses about 8mA when idle (typ).<br />
<br />
== Pinout ==<br />
<br />
For the SPI connector see: [[SPI_connector_pinout]]. <br />
<br />
For the I2C connector see: [[I2C_connector_pinout]]. <br />
<br />
{| border=1<br />
! pin !! function !! remark<br />
|-<br />
| 1 || NO 1 || Normally open contact for relay 1<br />
|-<br />
| 2 || C 1 || center connection for relay 1<br />
|- <br />
| 3 || NC 1 || normally closed contact for relay 1<br />
|-<br />
| 4 || NO 2 || Normally open contact for relay 2<br />
|-<br />
| 5 || C 2 || center connection for relay 2<br />
|- <br />
| 6 || NC 2 || normally closed contact for relay 2<br />
|-<br />
| colspan="3"| Only for BigRelay:<br />
|-<br />
| 7 || NO || Normally open contact for relay 3<br />
|-<br />
| 8 || C || center connection for relay 3<br />
|- <br />
| 9 || NC || normally closed contact for relay 3<br />
|-<br />
| 10 || NO || Normally open contact for relay 4<br />
|-<br />
| 11 || C || center connection for relay 4<br />
|- <br />
| 12 || NC || normally closed contact for relay 4<br />
|-<br />
| 13 || NO || Normally open contact for relay 5<br />
|-<br />
| 14 || C || center connection for relay 5<br />
|- <br />
| 15 || NC || normally closed contact for relay 5<br />
|-<br />
| 16 || NO || Normally open contact for relay 6<br />
|-<br />
| 17 || C || center connection for relay 6<br />
|- <br />
| 18 || NC || normally closed contact for relay 6<br />
|-<br />
|}<br />
<br />
== LEDs ==<br />
<br />
There is one power led. <br />
<br />
On the regular relay board are two LEDs near each of the relays indicating the state of the relays. The BigRelay board doesn't have indication LEDs.<br />
<br />
<br />
== Related projects ==<br />
<br />
* [[Temperature_control]]<br />
<br />
== External resources ==<br />
<br />
=== Datasheets ===<br />
<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]<br />
<br />
== Additional software ==<br />
[[bw_tool]]<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2919Raspberry Relay2014-08-27T11:48:14Z<p>Rijk: /* Pinout */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a relay output pin.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2917Raspberry Relay2014-08-25T15:20:00Z<p>Rijk: </p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Pinout ==<br />
[[File:RPiRelayPinout.jpg|thumb|300px|alt=Pin numbering|Pin numbering of the Relay Board]]<br />
{| border=1<br />
! Pin 1 !! Pin 2 !! Pin 3 !! Pin 4 !! Pin 5 !! Pin 6 !! Pin 7 !! Pin 8 !! Pin 9 !! Pin 10 <br />
|-<br />
| Neutral || Relay 1 out || Neutral || Relay 2 out || Neutral || Relay 3 out || Neutral || Relay 4 out || Neutral || Hot <br />
|}<br />
<br />
If you want to switch mains, you should connect the 'Hot' wire to pin 10. In EU countries, this is usually the brown wire. The blue wire is the 'Neutral', and should be connected to pin 9. All other wires should be connected in the same way, so 'Neutral' to 'Neutral' and a 'Hot' wire to a Relay output pin.<br />
<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=File:RPiRelayPinout.jpg&diff=2916File:RPiRelayPinout.jpg2014-08-25T15:06:18Z<p>Rijk: </p>
<hr />
<div></div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2915Raspberry Relay2014-08-25T14:36:22Z<p>Rijk: </p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
=== Shell ===<br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
=== Python ===<br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2914Raspberry Relay2014-08-25T14:35:21Z<p>Rijk: /* Usage */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Examples ==<br />
= Shell = <br />
* First, [http://wiringpi.com/download-and-install/ install WiringPi]<br />
* Set the GPIO modes:<br />
gpio mode 0 out<br />
gpio mode 1 out<br />
gpio mode 2 out<br />
gpio mode 3 out<br />
* Enabling a relay:<br />
gpio write X 1<br />
where X is the relay number (0 to 3)<br />
* Disabling a relay:<br />
gpio write X 0<br />
For more information about the gpio utility, see [https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ this page]<br />
= Python = <br />
* Install the RPi.GPIO Python module:<br />
sudo apt-get install python-rpi.gpio<br />
* start the python interpreter <br />
python<br />
* or create a script<br />
nano gpio.py<br />
* The Python script should look like this:<br />
#!/usr/bin/env python<br />
#import the GPIO library<br />
import RPi.GPIO as GPIO<br />
#select the board mode pin numbering<br />
GPIO.setmode(GPIO.BOARD)<br />
#set the needed GPIO pins as output<br />
GPIO.setup(11, GPIO.OUT) #relay 1<br />
GPIO.setup(12, GPIO.OUT) #relay 2<br />
GPIO.setup(13, GPIO.OUT) #relay 3<br />
GPIO.setup(15, GPIO.OUT) #relay 4<br />
#toggle the relays<br />
GPIO.output(13,True) #Enable relay 3 <br />
GPIO.output(11,False) #Disable relay 1<br />
* For more information on the RPi.GPIO module, see [https://pypi.python.org/pypi/RPi.GPIO this page].<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2913Raspberry Relay2014-08-25T14:18:55Z<p>Rijk: /* Datasheets */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2912Raspberry Relay2014-08-25T14:02:42Z<p>Rijk: /* Datasheets */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD-05VDC]<br />
10A variant: [http://www.omron.com/ecb/products/pdf/en-g5le.pdf Omron G5LE-14]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2911Raspberry Relay2014-08-25T13:11:16Z<p>Rijk: </p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}<br />
<br />
== Datasheets ==<br />
5A variant: [http://www.parallax.com/sites/default/files/downloads/27115-Single-Relay-Board-Datasheet.pdf Songle SRD]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Main_Page&diff=2910Main Page2014-08-25T12:58:17Z<p>Rijk: /* Board specific pages */</p>
<hr />
<div><big>'''BitWizard documentation wiki.'''</big><br />
<br />
This WIKI is for documentation of the BitWizard SPI/I2C expansion system and other boards, available from the [http://www.bitwizard.nl/catalog/ BitWizard Shop]. If you are considering adding information that is not related to one of our products, please contact us beforehand.<br><br />
It is expressly forbidden to add information intended to promote other sites. It is expressly forbidden to have a program add accounts and add articles with links to other sites. <br />
<br />
= How-to's =<br />
* [[Beginners guide to SPI on Raspberry Pi]]<br />
* [[installing and booting FriendlyArm mini6410]]<br />
<br />
= Kits =<br />
* [[RGB clock]]<br />
* [[Raspberry Pi camera extension kit]]<br />
<br />
<br />
= Developement boards =<br />
* [[Raspduino]]<br />
* [[FTDI_ATmega]]<br />
* [[USB-multio]]<br />
* [[usbbigmultio]]<br />
* [[Cyclone dev board]]<br />
<br />
= Expansion boards =<br />
<br />
== General ==<br />
* [[Default addresses]] (both SPI and I2C)<br />
* [[SPI versus I2C protocols]]<br />
* [[Daisy-chaining BitWizard I2C boards]]<br />
* [[USB Relay]]<br />
* [[Model B+ compatibility]]<br />
<br />
== Board specific pages ==<br />
These expansion boards come in I2C and SPI versions, and thus can be connected to a single bus. This allows you to easily expand your microcontroller system with new functions, without the cost of additional I/O pins.<br />
<br />
* [[LCD|LCD]]<br />
* [[DIO|DIO]]<br />
* [[Servo|Servo]]<br />
* [[7FETs|7FETs]]<br />
* [[3FETs|3FETs]]<br />
* [[temp|temp]]<br />
* [[relay|relay]]<br />
* [[motor|motor]]<br />
<!--<br />
* [[PiPower|PiPower]]<br />
--><br />
* [[Raspberry Juice]]<br />
* [[Raspberry Relay]]<br />
* [[User Interface|User Interface]]<br />
* [[7_Segment]]<br />
<!--<br />
* [[SPI_SPI]]<br />
--><br />
* [[pushbutton]]<br />
* [[rtc]]<br />
* [[Dimmer]]<br />
* [[16 LEDs]]<br />
<br />
== Other boards ==<br />
* [[USB-SATA powerswitch]]<br />
* [[USB-opto]]<br />
* [[Servotester]]<br />
<!--<br />
* [[USB relay board]]<br />
--><br />
<br />
== Breakout boards ==<br />
* [[FT245RL breakout board]]<br />
* [[FT2232H breakout board]]<br />
* [[Raspberry Pi Serial]]<br />
* [[FTDI serial]]<br />
* [[FTDI serial 2]]<br />
<br />
== I2C chips ==<br />
* [[I2C DAC|Dual MCP4726 DAC]]<br />
* [[I2C ADC|MCP3424 ADC]]<br />
* [[I2C splitter|PCA9548A I2C switch/mux]]<br />
* [[IO Expander|MCP23008 IO Expander]]<br />
<br />
== SPI chips ==<br />
* [[IO Expander|MCP23S08 IO Expander]]<br />
* [[SPI DAC|MCP4822 DAC]]<br />
<br />
= Sample programs =<br />
* [[Usbio kitt]]<br />
* [[Usbio ACM sample program]]<br />
* [[Raspberry Pi LCD program]]<br />
<!--<br />
= Preparing your development environment =<br />
* [[Linux]]<br />
* [[Windows]]<br />
* [[MacOS]]<br />
--><br />
= Sample projects =<br />
* [[temperature control]] (ftdi_atmega, spi_temp, spi_relay).<br />
<br />
= Raspberry Pi projects =<br />
* [[Reducing power consumption of a raspberry Pi]]<br />
* [[LCD + 3FETs demonstration|Connecting two 1602 LCDs and an RGB LED Strip to a Raspberry Pi]]<br />
* [[Connecting a motor and 1602 LCD to a Raspberry Pi]]<br />
* [[MPU-6050 sensor connected to Raspberry Pi]]<br />
* [[raspberry pi expansion system page]]<br />
* [[GPS reciever connected to Raspberry Pi]]<br />
<br />
<br />
= Help! =<br />
<br />
If you have trouble finding things on this wiki you can: <br />
* use the search function on the left<br />
* send us an email<br />
* or use the forum: http://forum.bitwizard.nl/ <br />
<br />
<br />
= Miscellaneous =<br />
* [[Solder jumpers]]<br />
* [[SPI_connector_pinout]]<br />
* [[template]]<br />
* [[Nikon D80 wired remote]]<br />
* [[Iphone 3GS camera]]</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2909Raspberry Relay2014-08-25T12:56:03Z<p>Rijk: /* Usage */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO21 (rev 1)/GPIO27 (rev 2) || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2908Raspberry Relay2014-08-25T12:37:39Z<p>Rijk: </p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.<br />
<br />
== Usage == <br />
The module can be controlled with the GPIO pins on the Pi. Set a pin high, the relay will switch on and when the pin is low the relay will switch off. The pins are wired as follows:<br />
<br />
{| border=1<br />
! Relay no. !! Pin number !! Pin name ([http://elinux.org/File:GPIOs.png Broadcom ref.]) !! Pin name ([http://wiringpi.com/pins/ wiringPi]) <br />
|-<br />
| 1 || 11 || GPIO17 || 0 <br />
|-<br />
| 2 || 12 || GPIO18 || 1<br />
|- <br />
| 3 || 13 || GPIO27 || 2<br />
|- <br />
| 4 || 15 || GPIO22 || 3<br />
|}</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2907Raspberry Relay2014-08-22T14:55:06Z<p>Rijk: /* Overview */</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the micro USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side. Please note that the polyfuse will be bypassed if the Pi is powered via the Relay board. The polyfuse prevents damage when a short-circuit occurs.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Relay&diff=2906Raspberry Relay2014-08-22T14:43:10Z<p>Rijk: Created page with "The Raspberry Relay board == Overview == The Raspberry Relay board can be connected to a Raspberry Pi using t..."</p>
<hr />
<div>[[File:RPiRelay.jpg|thumb|300px|alt=The Raspberry Relay board|The Raspberry Relay board]]<br />
<br />
== Overview ==<br />
The Raspberry Relay board can be connected to a Raspberry Pi using the 26-pin GPIO connector. The relays can be controlled using the Raspberry Pi GPIO pins. Optionally, the Pi can be powered by the USB port on the Relay board. This way, the connectors for power, ethernet and USB are on one side.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=File:RPiRelay.jpg&diff=2905File:RPiRelay.jpg2014-08-22T14:32:05Z<p>Rijk: </p>
<hr />
<div></div>Rijkhttps://bitwizard.nl/wiki/index.php?title=User_Interface&diff=2904User Interface2014-08-20T14:06:45Z<p>Rijk: </p>
<hr />
<div>[[File:RPi-UI.jpg|thumb|300px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
This is the documentation page for the RPi_UI board.<br />
<br />
<br />
<br />
== Installation ==<br />
See [[bw_tool#Setting up I2C/SPI under Linux | Setting up I2C/SPI under Linux]]<br />
<br />
<br />
== External resources ==<br />
<br />
<br />
=== Datasheets ===<br />
<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22266D.pdf MCP79412 (I2C RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf MCP79522 (SPI RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 thermistor]<br />
<br />
== Additional software ==<br />
<br />
The [[Bw_tool]] is meant to provide a basic commandline access to the bitwizard expansion boards<br />
<br />
<br />
== Pinout ==<br />
<br />
The 26 pin gpio connector is described at [http://elinux.org/RPi_Low-level_peripherals elinux]<br><br />
The SPI connector has the same pinout as the atmel 6-pin ICSP connector and is documented here: [[SPI_connector_pinout]].<br><br />
The I2C connector is documented here: [[I2C_connector_pinout]].<br><br />
The UART connector is documented here: [[uart connector pinout]].<br><br />
The analog connector has the following pinout:<br />
{| border=1<br />
! pin !! function <br />
|-<br />
| 1 || 5V<br />
|-<br />
| 2 || Analog in<br />
|-<br />
| 3 || GND<br />
|}<br />
<br />
<br />
Some people report they find it difficult to read the names of the connectors on the PCB. We'll fix that in a future version. In the meanwhile: <br />
[[File:Rpi_ui_docu.png|none|thumb|500px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
Note that for the 20x4 version of the board, the connectors are in the same order with the same pinout. <br />
<br />
=== LEDs ===<br />
<br />
The only LED is a power indicator.<br />
<br />
== jumper settings ==<br />
<br />
There is one 2x2 pin jumper (JP1), which controls which SPI bus (actually which SPI chip-select line) is routed to the AVRs slave-select pin, and which is routed to the reset pin (to enable reprogramming of the AVR):<br><br />
Left pads/pins connected: SPI0 connected to Slave-Select<br />
Right pads/pins connected: SPI1 connected to RESET<br />
Bottom pads/pins connected: SPI0 connected to RESET<br />
Top (near the LCD) pads/pins connected: SPI1 connected to Slave-Select<br />
<br />
The recommended configuration is to have 1-3 connected. The pins 1 and 2 are marked on the PCB. So 1-3 means the jumper is closest to the board edge, running from the "1" to the "J" of "JP1". <br />
<br />
People with the buttons/LCD on I2C can/should not install any jumpers here. <br />
<br />
There is also one solder jumper, SJ1, which controls the supply voltage on the SPI, I2C, and UART connectors:<br><br />
1-2: 5V (left)<br><br />
2-3: 3V3 (right, near the PCB edge)<br />
<br />
We deliver this jumper in the "5V" position with a small PCB trace. If you want to switch to 3.3V you'll have to cut the small trace with a knife.<br />
<br />
== Protocol ==<br />
<br />
To make the RPI_UI PCB do things, you need to send things over the SPI or I2C bus to the PCB. A comparison of the two protocols can be found [[SPI_versus_I2C_protocols|here]].<br />
<br />
The general overview of the SPI protocol is [[General_SPI_protocol|here]].<br />
<br />
the list of the default addresses is [[Default_addresses|here]].<br />
<br />
== The software ==<br />
<br />
Controlling the display works the same way as our SPI_LCD or I2C_LCD modules. Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.<br />
<br />
=== write ports ===<br />
<br />
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged. <br />
<br />
The rpi_ui board defines several ports. <br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x00 || display data.<br />
|- <br />
| 0x01 || write data as command to LCD.<br />
|- <br />
| 0x08 || Set startup message line 1. After setting the startup message please wait 100ms before sending the next line. works from version 1.6+<br />
|- <br />
| 0x09 || Set startup message line 2. <br />
|- <br />
| 0x0a || Set startup message line 3. <br />
|- <br />
| 0x0b || Set startup message line 4. <br />
|- <br />
| 0x10 || any data clears the screen. <br />
|- <br />
| 0x11 || move the cursor to line l, position p. <br>l is the top 3 bits<br>p is the bottom 5 bits of the data. <br />
|- <br />
| 0x12 || set contrast. <br />
|- <br />
| 0x13 || set backlight. <br />
|- <br />
| 0x14 || reinit LCD. The initialzation procedure of the LCD takes a long time. A timed delay of about 500ms is in order after issuing this command<br />
|-<br />
| 0x15 || send 0 to set overrun-status back to zero. <br />
|-<br />
| 0x17 || Set the boot-time backlight intensity. (0xff means: use programmed default (0xc0))<br />
|-<br />
| 0x20 || set display number-of-lines. These are passed on to the display software, but seem to have little effect. <br />
|-<br />
| 0x21 || set display number-of-characters. <br />
|-<br />
<br />
| 0x70 .. 0x71 || Select which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Set number of ADC channels to read<br />
|-<br />
| 0x81 || Set number of samples to add (we suggest using a power of 2) (two bytes) See: [[annoying bug]]<br />
|-<br />
| 0x82 || Set ammounts of bits to shift accumulated sample value<br />
|-<br />
| 0xf0 || change address. But need to unlock first. See below. <br> Might require a reboot to take effect.<br />
|-<br />
| 0xf1 || change address: unlock phase 1: write 0x55 here to start unlocking. <br />
|-<br />
| 0xf2 || change address: unlock phase 2: write 0xaa here to allow changing of the address (after writing 0x55 to f1). <br />
|}<br />
<br />
=== read ports ===<br />
The rpi_ui board supports several read ports: <br />
<br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x01 || identification string. (terminated with 0).<br />
|-<br />
| 0x02 || read eeprom (serial number). <br />
|-<br />
| 0x12 || contrast <br />
|-<br />
| 0x13 || backlight intensity<br />
|-<br />
| 0x15 || read FIFO overrun status. If different from previous value, you've had an overrun. Best to<br />
clear the screen and resend any data you want displayed. <br />
|-<br />
| 0x16 || read FIFO bytes-in-buffer. The fifo is 32 bytes, So you can send 20 chars to display if the value is less than 12. <br />
|-<br />
| 0x17 || read stored backlight intensity. <br />
|-<br />
| 0x20 || read button 1 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x21 || read button 2 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x22 || read button 3 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x23 || read button 4 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x24 || read button 5 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x25 || read button 6 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x30 || reports which buttons have been pushed since last read of this register<br><br />
If you keep a button pushed, it will read out as 1 multiple times<br />
|-<br />
| 0x31 || reports which buttons have been pushed since last read of this register (V1.2 and up)<br><br />
If you keep a button pushed, it will read out as 1 only once<br />
|-<br />
| 0x40 || read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x41 || read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x42 || read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x43 || read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x44 || read button 5 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x45 || read button 6 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x60.. 0x61 || Return analog value (2 bytes)<br />
|-<br />
| 0x68 .. 0x69 || Return added and bitshifted analog value (2 bytes)<br />
|-<br />
| 0x70 .. 0x71 || Return which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Return number of ADC channels to read<br />
|-<br />
| 0x81 || Return number of samples to add (two bytes)<br />
|-<br />
| 0x82 || Return ammounts of bits to shift accumulated sample value<br />
|}<br />
<br />
== Using the analog inputs ==<br />
<br />
Please see [[DIO_protocol#Using_the_analog_inputs|this]] chapter on the page explaining the DIO protocol. There are two major differences: <br />
* The internal reference voltage needs to be configured in a different way<br />
* The mapping of the analog inputs; please use the following table instead:<br />
<br />
{| border=1<br />
! IO pin !! value<br />
|-<br />
| temp || 0xC7 (Vref=1V1) OR 0x47 (Vref=Vcc=~5V)<br />
|-<br />
| ext || 0xC6 (Vref=1V1) OR 0x46 (Vref=Vcc=~5V)<br />
|}<br />
<br />
=== Example ===<br />
<br />
Setup the ADC (only needed once after reboot):<br />
bw_tool -a 94 -w 70:c7 //Set ADC channel 0 to temperature sensor, and internal 1V1 reference<br />
bw_tool -a 94 -w 80:01 //Set number of channels to sample to 1<br />
<br />
Read the value:<br />
bw_tool -a 94 -R 60:s // Read the result, output in hex<br />
<br />
== Using the temperature sensor ==<br />
<br />
The temperature sensor is a MCP9700. It's output voltage depends on the temperature. For more information, please see the [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 datasheet].<br />
<br />
An initialization and readout script are available on the [[Temperature sensor example]] page.<br />
<br />
== Using the RTC ==<br />
<br />
<br />
The User Interface can be equipped with either an SPI RTC or an I2C RTC.<br />
<br />
=== I2C ===<br />
<br />
The I2C RTC has a Linux driver, which is available in the standard kernels delivered with raspian. (and probably others too). <br />
<br />
Just issue: <br />
modprobe i2c:mcp7941x<br />
echo mcp7941x 0x6f > /sys/class/i2c-dev/i2c-1/device/new_device<br />
and the module is loaded and detects the RTC. <br />
<br />
You can then set the RTC with: "hwclock -w". This will write the unix clock to the RTC. Put a "hwclock -s" somewhere in your startup scripts to initialize the unix clock from the RTC.<br />
The version 1 raspberry pi's had the i2c-0 bus on the gpio connector, you for the older raspberry pi you'll need to change i2c-1 into i2c-0..<br />
<br />
=== SPI ===<br />
<br />
We are not aware of a device driver for the SPI version of the RTC. We can read/write the RTC with bw_tool from the commandline using the raw SPI bytes commandline option "--hex". The CPU on the board has to enable the CS line for the SPI RTC. This limits the speed of the SPI transactions a bit (50 kHz has been verified working). <br />
<br />
bw_tool -s 50000 --hex 96 12 20 1 2 34 5 6 7 89<br />
<br />
will write (0x12) the test-bytes 1 2 34 5 6 7 89 to the RAM at location 0x20 in the RAM. <br />
<br />
bw_tool -s 50000 --hex 96 13 20 0 0 0 0 0 0 0 0<br />
<br />
will read them back. <br />
<br />
Refer to the datasheet of the MCP79522 for information on the registers of the chip http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf<br />
<br />
= examples =<br />
<br />
== read identification ==<br />
<br />
read the identification string of the board.<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x95 || xx || select destination with address 0x94 for READ. <br />
|-<br />
| 0x01 || xx || identify<br />
|-<br />
| xx || 0x73 || 's'<br />
|-<br />
| xx || 0x70 || 'p'<br />
|-<br />
| xx || 0x69 || 'i'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== Send text to display ==<br />
Display the string "Hello World!" (only the first 5 bytes of the string shown). <br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x00 || xx || datastream<br />
|-<br />
| 0x48 || xx || 'H'<br />
|-<br />
| 0x65 || xx || 'e'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6f || xx || 'o'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== set cursor position ==<br />
move to line 1, character 5:<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x11 || xx || port 0x11 = set cursor position. <br />
|-<br />
| 0x25 || xx || 0x25 = 001 00101 = line 1 position 5. <br />
|}<br />
<br />
== bash script to show system informations ==<br />
<br />
This bash script shows the current time and load averages of the cpu. The refresh is set to 5 seconds.<br />
<br />
#!/bin/bash<br />
<br />
#clean the display<br />
bw_tool -I -a 94 -w 16:0<br />
<br />
while true; do<br />
#get cpu loads<br />
load=`top -bn1 | grep load | cut -d' ' -f13-`<br />
<br />
#print the current time <br />
bw_tool -I -a 94 -w 17:0<br />
bw_tool -I -a 94 -t `date +%H:%M:%S`<br />
<br />
#print the load averages<br />
bw_tool -I -a 94 -w 17:32<br />
bw_tool -I -a 94 -t $load<br />
<br />
#idle for 5 seconds<br />
sleep 5<br />
done<br />
<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=User_Interface&diff=2903User Interface2014-08-20T14:05:36Z<p>Rijk: /* SPI */</p>
<hr />
<div>[[File:RPi-UI.jpg|thumb|300px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
This is the documentation page for the RPi_UI board.<br />
<br />
<br />
<br />
== Installation ==<br />
See [[bw_tool#Setting up I2C/SPI under Linux | Setting up I2C/SPI under Linux]]<br />
<br />
<br />
== External resources ==<br />
<br />
<br />
=== Datasheets ===<br />
<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22266D.pdf MCP79412 (I2C RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf MCP79522 (SPI RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 thermistor]<br />
<br />
== Additional software ==<br />
<br />
The [[Bw_tool]] is meant to provide a basic commandline access to the bitwizard expansion boards<br />
<br />
<br />
== Pinout ==<br />
<br />
The 26 pin gpio connector is described at [http://elinux.org/RPi_Low-level_peripherals elinux]<br><br />
The SPI connector has the same pinout as the atmel 6-pin ICSP connector and is documented here: [[SPI_connector_pinout]].<br><br />
The I2C connector is documented here: [[I2C_connector_pinout]].<br><br />
The UART connector is documented here: [[uart connector pinout]].<br><br />
The analog connector has the following pinout:<br />
{| border=1<br />
! pin !! function <br />
|-<br />
| 1 || 5V<br />
|-<br />
| 2 || Analog in<br />
|-<br />
| 3 || GND<br />
|}<br />
<br />
<br />
Some people report they find it difficult to read the names of the connectors on the PCB. We'll fix that in a future version. In the meanwhile: <br />
[[File:Rpi_ui_docu.png|none|thumb|500px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
Note that for the 20x4 version of the board, the connectors are in the same order with the same pinout. <br />
<br />
=== LEDs ===<br />
<br />
The only LED is a power indicator.<br />
<br />
== jumper settings ==<br />
<br />
There is one 2x2 pin jumper (JP1), which controls which SPI bus (actually which SPI chip-select line) is routed to the AVRs slave-select pin, and which is routed to the reset pin (to enable reprogramming of the AVR):<br><br />
Left pads/pins connected: SPI0 connected to Slave-Select<br />
Right pads/pins connected: SPI1 connected to RESET<br />
Bottom pads/pins connected: SPI0 connected to RESET<br />
Top (near the LCD) pads/pins connected: SPI1 connected to Slave-Select<br />
<br />
The recommended configuration is to have 1-3 connected. The pins 1 and 2 are marked on the PCB. So 1-3 means the jumper is closest to the board edge, running from the "1" to the "J" of "JP1". <br />
<br />
People with the buttons/LCD on I2C can/should not install any jumpers here. <br />
<br />
There is also one solder jumper, SJ1, which controls the supply voltage on the SPI, I2C, and UART connectors:<br><br />
1-2: 5V (left)<br><br />
2-3: 3V3 (right, near the PCB edge)<br />
<br />
We deliver this jumper in the "5V" position with a small PCB trace. If you want to switch to 3.3V you'll have to cut the small trace with a knife.<br />
<br />
== Protocol ==<br />
<br />
To make the RPI_UI PCB do things, you need to send things over the SPI or I2C bus to the PCB. A comparison of the two protocols can be found [[SPI_versus_I2C_protocols|here]].<br />
<br />
The general overview of the SPI protocol is [[General_SPI_protocol|here]].<br />
<br />
the list of the default addresses is [[Default_addresses|here]].<br />
<br />
== The software ==<br />
<br />
Controlling the display works the same way as our SPI_LCD or I2C_LCD modules. Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.<br />
<br />
=== write ports ===<br />
<br />
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged. <br />
<br />
The rpi_ui board defines several ports. <br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x00 || display data.<br />
|- <br />
| 0x01 || write data as command to LCD.<br />
|- <br />
| 0x08 || Set startup message line 1. After setting the startup message please wait 100ms before sending the next line. works from version 1.6+<br />
|- <br />
| 0x09 || Set startup message line 2. <br />
|- <br />
| 0x0a || Set startup message line 3. <br />
|- <br />
| 0x0b || Set startup message line 4. <br />
|- <br />
| 0x10 || any data clears the screen. <br />
|- <br />
| 0x11 || move the cursor to line l, position p. <br>l is the top 3 bits<br>p is the bottom 5 bits of the data. <br />
|- <br />
| 0x12 || set contrast. <br />
|- <br />
| 0x13 || set backlight. <br />
|- <br />
| 0x14 || reinit LCD. The initialzation procedure of the LCD takes a long time. A timed delay of about 500ms is in order after issuing this command<br />
|-<br />
| 0x15 || send 0 to set overrun-status back to zero. <br />
|-<br />
| 0x17 || Set the boot-time backlight intensity. (0xff means: use programmed default (0xc0))<br />
|-<br />
| 0x20 || set display number-of-lines. These are passed on to the display software, but seem to have little effect. <br />
|-<br />
| 0x21 || set display number-of-characters. <br />
|-<br />
<br />
| 0x70 .. 0x71 || Select which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Set number of ADC channels to read<br />
|-<br />
| 0x81 || Set number of samples to add (we suggest using a power of 2) (two bytes) See: [[annoying bug]]<br />
|-<br />
| 0x82 || Set ammounts of bits to shift accumulated sample value<br />
|-<br />
| 0xf0 || change address. But need to unlock first. See below. <br> Might require a reboot to take effect.<br />
|-<br />
| 0xf1 || change address: unlock phase 1: write 0x55 here to start unlocking. <br />
|-<br />
| 0xf2 || change address: unlock phase 2: write 0xaa here to allow changing of the address (after writing 0x55 to f1). <br />
|}<br />
<br />
=== read ports ===<br />
The rpi_ui board supports several read ports: <br />
<br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x01 || identification string. (terminated with 0).<br />
|-<br />
| 0x02 || read eeprom (serial number). <br />
|-<br />
| 0x12 || contrast <br />
|-<br />
| 0x13 || backlight intensity<br />
|-<br />
| 0x15 || read FIFO overrun status. If different from previous value, you've had an overrun. Best to<br />
clear the screen and resend any data you want displayed. <br />
|-<br />
| 0x16 || read FIFO bytes-in-buffer. The fifo is 32 bytes, So you can send 20 chars to display if the value is less than 12. <br />
|-<br />
| 0x17 || read stored backlight intensity. <br />
|-<br />
| 0x20 || read button 1 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x21 || read button 2 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x22 || read button 3 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x23 || read button 4 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x24 || read button 5 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x25 || read button 6 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x30 || reports which buttons have been pushed since last read of this register<br><br />
If you keep a button pushed, it will read out as 1 multiple times<br />
|-<br />
| 0x31 || reports which buttons have been pushed since last read of this register (V1.2 and up)<br><br />
If you keep a button pushed, it will read out as 1 only once<br />
|-<br />
| 0x40 || read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x41 || read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x42 || read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x43 || read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x44 || read button 5 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x45 || read button 6 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x60.. 0x61 || Return analog value (2 bytes)<br />
|-<br />
| 0x68 .. 0x69 || Return added and bitshifted analog value (2 bytes)<br />
|-<br />
| 0x70 .. 0x71 || Return which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Return number of ADC channels to read<br />
|-<br />
| 0x81 || Return number of samples to add (two bytes)<br />
|-<br />
| 0x82 || Return ammounts of bits to shift accumulated sample value<br />
|}<br />
<br />
== Using the analog inputs ==<br />
<br />
Please see [[DIO_protocol#Using_the_analog_inputs|this]] chapter on the page explaining the DIO protocol. There are two major differences: <br />
* The internal reference voltage needs to be configured in a different way<br />
* The mapping of the analog inputs; please use the following table instead:<br />
<br />
{| border=1<br />
! IO pin !! value<br />
|-<br />
| temp || 0xC7 (Vref=1V1) OR 0x47 (Vref=Vcc=~5V)<br />
|-<br />
| ext || 0xC6 (Vref=1V1) OR 0x46 (Vref=Vcc=~5V)<br />
|}<br />
<br />
=== Example ===<br />
<br />
Setup the ADC (only needed once after reboot):<br />
bw_tool -a 94 -w 70:c7 //Set ADC channel 0 to temperature sensor, and internal 1V1 reference<br />
bw_tool -a 94 -w 80:01 //Set number of channels to sample to 1<br />
<br />
Read the value:<br />
bw_tool -a 94 -R 60:s // Read the result, output in hex<br />
<br />
== Using the temperature sensor ==<br />
<br />
The temperature sensor is a MCP9700. It's output voltage depends on the temperature. For more information, please see the [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 datasheet].<br />
<br />
An initialization and readout script are available on the [[Temperature sensor example]] page.<br />
<br />
== Using the RTC ==<br />
<br />
<br />
The User Interface can be equipped with either an SPI RTC or an I2C RTC.<br />
<br />
=== I2C ===<br />
<br />
The I2C RTC has a Linux driver, which is available in the standard kernels delivered with raspian. (and probably others too). <br />
<br />
Just issue: <br />
modprobe i2c:mcp7941x<br />
echo mcp7941x 0x6f > /sys/class/i2c-dev/i2c-1/device/new_device<br />
and the module is loaded and detects the RTC. <br />
<br />
You can then set the RTC with: "hwclock -w". This will write the unix clock to the RTC. Put a "hwclock -s" somewhere in your startup scripts to initialize the unix clock from the RTC.<br />
The version 1 raspberry pi's had the i2c-0 bus on the gpio connector, you for the older raspberry pi you'll need to change i2c-1 into i2c-0..<br />
<br />
=== SPI ===<br />
<br />
We are not aware of a device driver for the SPI version of the RTC. We can read/write the RTC with bw_tool from the commandline using the raw SPI bytes commandline option "--hex". The CPU on the board has to enable the CS line for the SPI RTC. This limits the speed of the SPI transactions a bit (50 kHz has been verified working). <br />
<br />
bw_tool -s 50000 --hex 96 12 20 1 2 34 5 6 7 89<br />
<br />
will write (0x12) the test-bytes 1 2 34 5 6 7 89 to the RAM at location 0x20 in the RAM. <br />
<br />
bw_tool -s 50000 --hex 96 13 20 0 0 0 0 0 0 0 0<br />
<br />
will read them back. <br />
<br />
Refer to the datasheet of the MCP79522 for information on the registers of the chip http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf<br />
<br />
= examples =<br />
<br />
== read identification ==<br />
<br />
read the identification string of the board.<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x95 || xx || select destination with address 0x94 for READ. <br />
|-<br />
| 0x01 || xx || identify<br />
|-<br />
| xx || 0x73 || 's'<br />
|-<br />
| xx || 0x70 || 'p'<br />
|-<br />
| xx || 0x69 || 'i'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== Send text to display ==<br />
Display the string "Hello World!" (only the first 5 bytes of the string shown). <br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x00 || xx || datastream<br />
|-<br />
| 0x48 || xx || 'H'<br />
|-<br />
| 0x65 || xx || 'e'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6f || xx || 'o'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== set cursor position ==<br />
move to line 1, character 5:<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x11 || xx || port 0x11 = set cursor position. <br />
|-<br />
| 0x25 || xx || 0x25 = 001 00101 = line 1 position 5. <br />
|}<br />
<br />
== bash script to show system informations ==<br />
<br />
This bash script shows the current time and load averages of the cpu. The refresh is set to 5 seconds.<br />
<br />
#!/bin/bash<br />
<br />
#clean the display<br />
bw_tool -I -a 94 -w 16:0<br />
<br />
while true; do<br />
#get cpu loads<br />
load=`top -bn1 | grep load | cut -d' ' -f13-`<br />
<br />
#print the current time <br />
bw_tool -I -a 94 -w 17:0<br />
bw_tool -I -a 94 -t `date +%H:%M:%S`<br />
<br />
#print the load averages<br />
bw_tool -I -a 94 -w 17:32<br />
bw_tool -I -a 94 -t $load<br />
<br />
#idle for 5 seconds<br />
sleep 5<br />
done<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=User_Interface&diff=2902User Interface2014-08-20T14:05:12Z<p>Rijk: /* SPI */</p>
<hr />
<div>[[File:RPi-UI.jpg|thumb|300px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
This is the documentation page for the RPi_UI board.<br />
<br />
<br />
<br />
== Installation ==<br />
See [[bw_tool#Setting up I2C/SPI under Linux | Setting up I2C/SPI under Linux]]<br />
<br />
<br />
== External resources ==<br />
<br />
<br />
=== Datasheets ===<br />
<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22266D.pdf MCP79412 (I2C RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf MCP79522 (SPI RTC)]<br />
* [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 thermistor]<br />
<br />
== Additional software ==<br />
<br />
The [[Bw_tool]] is meant to provide a basic commandline access to the bitwizard expansion boards<br />
<br />
<br />
== Pinout ==<br />
<br />
The 26 pin gpio connector is described at [http://elinux.org/RPi_Low-level_peripherals elinux]<br><br />
The SPI connector has the same pinout as the atmel 6-pin ICSP connector and is documented here: [[SPI_connector_pinout]].<br><br />
The I2C connector is documented here: [[I2C_connector_pinout]].<br><br />
The UART connector is documented here: [[uart connector pinout]].<br><br />
The analog connector has the following pinout:<br />
{| border=1<br />
! pin !! function <br />
|-<br />
| 1 || 5V<br />
|-<br />
| 2 || Analog in<br />
|-<br />
| 3 || GND<br />
|}<br />
<br />
<br />
Some people report they find it difficult to read the names of the connectors on the PCB. We'll fix that in a future version. In the meanwhile: <br />
[[File:Rpi_ui_docu.png|none|thumb|500px|alt=The RPi_UI PCB|The RPi_UI PCB]]<br />
<br />
Note that for the 20x4 version of the board, the connectors are in the same order with the same pinout. <br />
<br />
=== LEDs ===<br />
<br />
The only LED is a power indicator.<br />
<br />
== jumper settings ==<br />
<br />
There is one 2x2 pin jumper (JP1), which controls which SPI bus (actually which SPI chip-select line) is routed to the AVRs slave-select pin, and which is routed to the reset pin (to enable reprogramming of the AVR):<br><br />
Left pads/pins connected: SPI0 connected to Slave-Select<br />
Right pads/pins connected: SPI1 connected to RESET<br />
Bottom pads/pins connected: SPI0 connected to RESET<br />
Top (near the LCD) pads/pins connected: SPI1 connected to Slave-Select<br />
<br />
The recommended configuration is to have 1-3 connected. The pins 1 and 2 are marked on the PCB. So 1-3 means the jumper is closest to the board edge, running from the "1" to the "J" of "JP1". <br />
<br />
People with the buttons/LCD on I2C can/should not install any jumpers here. <br />
<br />
There is also one solder jumper, SJ1, which controls the supply voltage on the SPI, I2C, and UART connectors:<br><br />
1-2: 5V (left)<br><br />
2-3: 3V3 (right, near the PCB edge)<br />
<br />
We deliver this jumper in the "5V" position with a small PCB trace. If you want to switch to 3.3V you'll have to cut the small trace with a knife.<br />
<br />
== Protocol ==<br />
<br />
To make the RPI_UI PCB do things, you need to send things over the SPI or I2C bus to the PCB. A comparison of the two protocols can be found [[SPI_versus_I2C_protocols|here]].<br />
<br />
The general overview of the SPI protocol is [[General_SPI_protocol|here]].<br />
<br />
the list of the default addresses is [[Default_addresses|here]].<br />
<br />
== The software ==<br />
<br />
Controlling the display works the same way as our SPI_LCD or I2C_LCD modules. Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.<br />
<br />
=== write ports ===<br />
<br />
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged. <br />
<br />
The rpi_ui board defines several ports. <br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x00 || display data.<br />
|- <br />
| 0x01 || write data as command to LCD.<br />
|- <br />
| 0x08 || Set startup message line 1. After setting the startup message please wait 100ms before sending the next line. works from version 1.6+<br />
|- <br />
| 0x09 || Set startup message line 2. <br />
|- <br />
| 0x0a || Set startup message line 3. <br />
|- <br />
| 0x0b || Set startup message line 4. <br />
|- <br />
| 0x10 || any data clears the screen. <br />
|- <br />
| 0x11 || move the cursor to line l, position p. <br>l is the top 3 bits<br>p is the bottom 5 bits of the data. <br />
|- <br />
| 0x12 || set contrast. <br />
|- <br />
| 0x13 || set backlight. <br />
|- <br />
| 0x14 || reinit LCD. The initialzation procedure of the LCD takes a long time. A timed delay of about 500ms is in order after issuing this command<br />
|-<br />
| 0x15 || send 0 to set overrun-status back to zero. <br />
|-<br />
| 0x17 || Set the boot-time backlight intensity. (0xff means: use programmed default (0xc0))<br />
|-<br />
| 0x20 || set display number-of-lines. These are passed on to the display software, but seem to have little effect. <br />
|-<br />
| 0x21 || set display number-of-characters. <br />
|-<br />
<br />
| 0x70 .. 0x71 || Select which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Set number of ADC channels to read<br />
|-<br />
| 0x81 || Set number of samples to add (we suggest using a power of 2) (two bytes) See: [[annoying bug]]<br />
|-<br />
| 0x82 || Set ammounts of bits to shift accumulated sample value<br />
|-<br />
| 0xf0 || change address. But need to unlock first. See below. <br> Might require a reboot to take effect.<br />
|-<br />
| 0xf1 || change address: unlock phase 1: write 0x55 here to start unlocking. <br />
|-<br />
| 0xf2 || change address: unlock phase 2: write 0xaa here to allow changing of the address (after writing 0x55 to f1). <br />
|}<br />
<br />
=== read ports ===<br />
The rpi_ui board supports several read ports: <br />
<br />
{| border=1<br />
! port !! function <br />
|-<br />
| 0x01 || identification string. (terminated with 0).<br />
|-<br />
| 0x02 || read eeprom (serial number). <br />
|-<br />
| 0x12 || contrast <br />
|-<br />
| 0x13 || backlight intensity<br />
|-<br />
| 0x15 || read FIFO overrun status. If different from previous value, you've had an overrun. Best to<br />
clear the screen and resend any data you want displayed. <br />
|-<br />
| 0x16 || read FIFO bytes-in-buffer. The fifo is 32 bytes, So you can send 20 chars to display if the value is less than 12. <br />
|-<br />
| 0x17 || read stored backlight intensity. <br />
|-<br />
| 0x20 || read button 1 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x21 || read button 2 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x22 || read button 3 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x23 || read button 4 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x24 || read button 5 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x25 || read button 6 (1 means NOT pushed, 0 means pushed)<br />
|-<br />
| 0x30 || reports which buttons have been pushed since last read of this register<br><br />
If you keep a button pushed, it will read out as 1 multiple times<br />
|-<br />
| 0x31 || reports which buttons have been pushed since last read of this register (V1.2 and up)<br><br />
If you keep a button pushed, it will read out as 1 only once<br />
|-<br />
| 0x40 || read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x41 || read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x42 || read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x43 || read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x44 || read button 5 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x45 || read button 6 (1 means pushed, 0 means NOT pushed) (V1.1 and up)<br />
|-<br />
| 0x60.. 0x61 || Return analog value (2 bytes)<br />
|-<br />
| 0x68 .. 0x69 || Return added and bitshifted analog value (2 bytes)<br />
|-<br />
| 0x70 .. 0x71 || Return which i/o is coupled to which ADC channel<br />
|-<br />
| 0x80 || Return number of ADC channels to read<br />
|-<br />
| 0x81 || Return number of samples to add (two bytes)<br />
|-<br />
| 0x82 || Return ammounts of bits to shift accumulated sample value<br />
|}<br />
<br />
== Using the analog inputs ==<br />
<br />
Please see [[DIO_protocol#Using_the_analog_inputs|this]] chapter on the page explaining the DIO protocol. There are two major differences: <br />
* The internal reference voltage needs to be configured in a different way<br />
* The mapping of the analog inputs; please use the following table instead:<br />
<br />
{| border=1<br />
! IO pin !! value<br />
|-<br />
| temp || 0xC7 (Vref=1V1) OR 0x47 (Vref=Vcc=~5V)<br />
|-<br />
| ext || 0xC6 (Vref=1V1) OR 0x46 (Vref=Vcc=~5V)<br />
|}<br />
<br />
=== Example ===<br />
<br />
Setup the ADC (only needed once after reboot):<br />
bw_tool -a 94 -w 70:c7 //Set ADC channel 0 to temperature sensor, and internal 1V1 reference<br />
bw_tool -a 94 -w 80:01 //Set number of channels to sample to 1<br />
<br />
Read the value:<br />
bw_tool -a 94 -R 60:s // Read the result, output in hex<br />
<br />
== Using the temperature sensor ==<br />
<br />
The temperature sensor is a MCP9700. It's output voltage depends on the temperature. For more information, please see the [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 datasheet].<br />
<br />
An initialization and readout script are available on the [[Temperature sensor example]] page.<br />
<br />
== Using the RTC ==<br />
<br />
<br />
The User Interface can be equipped with either an SPI RTC or an I2C RTC.<br />
<br />
=== I2C ===<br />
<br />
The I2C RTC has a Linux driver, which is available in the standard kernels delivered with raspian. (and probably others too). <br />
<br />
Just issue: <br />
modprobe i2c:mcp7941x<br />
echo mcp7941x 0x6f > /sys/class/i2c-dev/i2c-1/device/new_device<br />
and the module is loaded and detects the RTC. <br />
<br />
You can then set the RTC with: "hwclock -w". This will write the unix clock to the RTC. Put a "hwclock -s" somewhere in your startup scripts to initialize the unix clock from the RTC.<br />
The version 1 raspberry pi's had the i2c-0 bus on the gpio connector, you for the older raspberry pi you'll need to change i2c-1 into i2c-0..<br />
<br />
=== SPI ===<br />
<br />
We are not aware of a device driver for the SPI version of the RTC. We can read/write the RTC with bw_tool from the commandline using the raw SPI bytes commandline option "--hex". The CPU on the board has to enable the CS line for the SPI RTC. This limits the speed of the SPI transactions a bit (50 kHz works). <br />
<br />
bw_tool -s 50000 --hex 96 12 20 1 2 34 5 6 7 89<br />
<br />
will write (0x12) the test-bytes 1 2 34 5 6 7 89 to the RAM at location 0x20 in the RAM. <br />
<br />
bw_tool -s 50000 --hex 96 13 20 0 0 0 0 0 0 0 0<br />
<br />
will read them back. <br />
<br />
Refer to the datasheet of the MCP79522 for information on the registers of the chip http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf<br />
<br />
= examples =<br />
<br />
== read identification ==<br />
<br />
read the identification string of the board.<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x95 || xx || select destination with address 0x94 for READ. <br />
|-<br />
| 0x01 || xx || identify<br />
|-<br />
| xx || 0x73 || 's'<br />
|-<br />
| xx || 0x70 || 'p'<br />
|-<br />
| xx || 0x69 || 'i'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== Send text to display ==<br />
Display the string "Hello World!" (only the first 5 bytes of the string shown). <br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x00 || xx || datastream<br />
|-<br />
| 0x48 || xx || 'H'<br />
|-<br />
| 0x65 || xx || 'e'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6c || xx || 'l'<br />
|-<br />
| 0x6f || xx || 'o'<br />
|-<br />
| xx || ... || etc. <br />
|}<br />
<br />
== set cursor position ==<br />
move to line 1, character 5:<br />
{| border=1<br />
! data sent !! data recieved || explanation <br />
|-<br />
| 0x94 || xx || select destination with address 0x94 for WRITE<br />
|-<br />
| 0x11 || xx || port 0x11 = set cursor position. <br />
|-<br />
| 0x25 || xx || 0x25 = 001 00101 = line 1 position 5. <br />
|}<br />
<br />
== bash script to show system informations ==<br />
<br />
This bash script shows the current time and load averages of the cpu. The refresh is set to 5 seconds.<br />
<br />
#!/bin/bash<br />
<br />
#clean the display<br />
bw_tool -I -a 94 -w 16:0<br />
<br />
while true; do<br />
#get cpu loads<br />
load=`top -bn1 | grep load | cut -d' ' -f13-`<br />
<br />
#print the current time <br />
bw_tool -I -a 94 -w 17:0<br />
bw_tool -I -a 94 -t `date +%H:%M:%S`<br />
<br />
#print the load averages<br />
bw_tool -I -a 94 -w 17:32<br />
bw_tool -I -a 94 -t $load<br />
<br />
#idle for 5 seconds<br />
sleep 5<br />
done<br />
<br />
== Default operation ==<br />
<br />
<br />
== Future hardware enhancements ==<br />
<br />
<br />
== Future software enhancements ==<br />
<br />
<br />
== Changelog ==<br />
<br />
<br />
=== 1.0 ===<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Bw_tool&diff=2901Bw tool2014-08-20T14:03:22Z<p>Rijk: /* Setting up I2C/SPI under Linux */</p>
<hr />
<div>= Intro =<br />
<br />
The bw_tool is meant to provide a basic commandline access to the bitwizard expansion boards. It was written for the Raspberry Pi, but has now been proven to work on other Linux platforms with an spidev device as well. <br />
<br />
= Installation/Compiling =<br />
<br />
You can download the bw_tool [https://github.com/rewolff/bw_rpi_tools here]. If you are using git just type <br />
''git clone https://github.com/rewolff/bw_rpi_tools.git'' <br />
<br />
Nowadays the "bw_tool" is the only directory of interest. Go there and build:<br />
''cd bw_tool; make'' <br />
should work fine. If things went smoothly (which they usually do) you can install the binary so that normal people can find it: <br />
''make install''<br />
<br />
== Setting up I2C/SPI under Linux ==<br />
To get Linux to work with SPI/I2C the proper modules need to be loaded. To do this automatically on boot:<br />
<br />
'''0''': (on Raspberry Pi) edit /etc/modprobe.d/raspi-blacklist.conf to look like this:<br />
# blacklist spi and i2c by default (many users don't need them)<br />
#blacklist spi-bcm2708<br />
#blacklist i2c-bcm2708<br />
'''1''': Add the following lines to /etc/modules:<br />
i2c-dev<br />
spidev<br />
'''2''': Reboot<br />
<br />
= Basic Example =<br />
<br />
The simplest invocation:<br />
<br />
bw_tool -t "Hello World!"<br />
<br />
will display the shown text on an SPI_LCD on the default SPI bus (SPI0). Options modify the defaults.<br />
<br />
= About Permissions =<br />
<br />
The above command needs access to the SPI bus. By default Linux does not know if letting users access this bus is going to compromise the system or not. As a result, Linux chooses to only allow the root user access to the SPI or I2C bus by default. So you have the following choices: <br />
<br />
* You can run your whole session as root. Run "sudo -i" to gain root access.<br />
* You can issue only the commands that require spi-bus access as root by prefixing them with "sudo". e.g.:<br />
sudo bw_tool -t "Hello World!"<br />
* If you are using I2C only, you could add yourself to the I2C group (assuming your username is "pi") :<br />
sudo gpasswd -a pi i2c<br />
or:<br />
sudo usermod -a -G i2c pi<br />
You only need to run one of these commands once. Afterwards, log out and back in. To verify if the command succeeded, run:<br />
groups<br />
it should return something like:<br />
pi adm dialout cdrom sudo audio video plugdev games users '''i2c'''<br />
* you can change the permissions on the device files: <br />
sudo chmod 666 /dev/spidev*<br />
sudo chmod 666 /dev/i2c-*<br />
<br />
Since the "/dev" filesystem is kept in RAM, you will need to do that again, at every boot. You could add those commands to /etc/rc.local to issue them automatically at every boot, but a better way is to use [https://wiki.debian.org/udev| udev] for this. To do that create (as root) the file /etc/udev/rules.d/70-i2cspi.rules with the following contents:<br />
SUBSYSTEM=="spidev", MODE="0666"<br />
SUBSYSTEM=="i2c-dev", MODE="0666"<br />
and reboot. All I2C and SPI devices should now be world writable.<br />
<br />
= Options =<br />
<br />
== Options Specifying the Device ==<br />
<br />
The option <br />
-I <br />
will switch to I2C mode. <br />
<br />
The option <br />
-D <device> <br />
will use that device. Specify /dev/spidev0.1 for the second SPI bus on the raspberry pi for example. Or /dev/i2c-1 to specify the second I2C bus. On revision 2 Raspberry Pi's, the I2C buses are switched. While on rev. 1 Pi's <br />
The option<br />
-a <address> <br />
specifies the address of the device to use. Note that BitWizard uses the full 8 bits that are sent to the device. Add one for "read" operation. In some circles, notably I2C, it is customary to specify just those 7 bits. Thus when the I2C_LCD is at the default address of 0x82, i2cdetect will scan it at address 0x41. <br />
<br />
== Identifying the Device ==<br />
To check for a proper connection to the device, one could use the identify command line switch -i. For instance, a Raspberry Pi UI connected via I2C could be checked with<br />
bw_tool -I -D /dev/i2c-0 -a 94 -i<br />
returnes <br />
I2C_rpi_ui 1.6<br />
<br />
== Sending Data ==<br />
<br />
the option <br />
-t "text" <br />
will send the text to the device, at port zero. The port cannot be changed, but all BitWizard PCBs that have the option of displaying text have the text port at port zero. <br />
<br />
The option<br />
-w <addr>:<byte> <br />
will write the byte to the port at addr. For LCD-equipped boards for example -w 12:50 will set the contrast to 0x50. <br />
<br />
The option<br />
-W <addr>:<short><br />
will write the 16-bit short to the port at addr. For example -W 81:1000 will write the value 0x1000 to the numsamples port on an analog-equipped board.<br />
<br />
== Reading Data ==<br />
<br />
The option <br />
-R <port>:<datasize><br />
reads the data at port from the device. Datasize can be 'b' for byte (default), 's' for short (16 bits), or 'i' for a 32-bit integer. <br />
<br />
== Finetuning ==<br />
<br />
To test sending data to SPI devices, there is the <br />
--hex [byte...]<br />
option. This simply sends the bytes specified, and reports back what was received. Note that BitWizard boards will not send any data until they have been selected, so the first byte received will represent whatever static is found on the bus.<br />
<br />
= Known Bugs =<br />
* The identify command returns two garbled characters when used in I2C mode</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspberry_Juice&diff=2899Raspberry Juice2014-08-18T15:00:59Z<p>Rijk: </p>
<hr />
<div>[[File:RaspberryJuice.jpg|thumb|300px|The Raspberry Juice board]]<br />
<br />
<br />
= Overview = <br />
The Raspberry Juice serves as a power switch for the Raspberry Pi. This expansion board can turn the power on or off at a scheduled time. [http://www.bitwizard.nl/shop/raspberry-pi/raspberry-juice shop link]<br />
<br />
= Specifications = <br />
The Juice always uses about 2mA/10mW. The board is rated for a maximum current of 1A.<br />
<br />
= Use = <br />
The Raspberry Juice can be found using I2C or SPI at address 0xA4, and has the following read ports:<br />
All times are in ms, and are 32 bits in size. <br />
{| border=1<br />
! Port !! Returned value (in milliseconds)<br />
|-<br />
| 0x20 || Time until power off<br />
|-<br />
| 0x21 || Time until power on<br />
<br />
<!--<br />
|-<br />
| 0x28 || Absolute scheduled time of power off<br />
|-<br />
| 0x29 || Absolute scheduled time of power on <br />
--><br />
|-<br />
| 0x30 || button active || 0: don't react to button press. 1: react to button press (default), others: undefined. <br />
|-<br />
| 0x31 || external input active || 0: inactive (default), 1: active, others: undefined. <br />
|-<br />
| 0x32 || external input polarity || 0: active low (default), 1: active high, others: undefined. <br />
|-<br />
| 0x33 || power set on/off state || 0: off, 1: on, others: undefined. <br />
<br />
|-<br />
| 0x38 || button active powerupstate || 0: don't react to button press. 1: react to button press (default), others: undefined. <br />
|-<br />
| 0x39 || external input active powerupstate || 0: inactive (default), 1: active, others: undefined. <br />
|-<br />
| 0x3a || external input polarity powerupstate || 0: active low (default), 1: active high, others: undefined. <br />
|-<br />
| 0x3b || power set on/off state powerupstate || 0: off, 1: on, others: undefined. <br />
|}<br />
<br />
Additionally, the following can be written to the Juice:<br />
{| border=1<br />
! Port !! Effect<br />
|-<br />
| 0x20 || Set the time in milliseconds until power off<br />
|-<br />
| 0x21 || Set the time in milliseconds until power on<br />
|-<br />
<br />
<br />
| 0x30 || button active || 0: don't react to button press. 1: react to button press (default), others: undefined. <br />
|-<br />
| 0x31 || external input active || 0: inactive (default), 1: active, others: undefined. <br />
|-<br />
| 0x32 || external input polarity || 0: active low (default), 1: active high, others: undefined. <br />
|-<br />
| 0x33 || power set on/off state || 0: off, 1: on, others: undefined. <br />
<br />
|-<br />
| 0x38 || button active powerupstate || 0: don't react to button press. 1: react to button press (default), others: undefined. <br />
|-<br />
| 0x39 || external input active powerupstate || 0: inactive (default), 1: active, others: undefined. <br />
|-<br />
| 0x3a || external input polarity powerupstate || 0: active low (default), 1: active high, others: undefined. <br />
|-<br />
| 0x3b || power set on/off state powerupstate || 0: off, 1: on, others: undefined. <br />
|}<br />
<br />
So, for instance, writing 10000 to port 0x21 and 1000 to 0x20 will cut the power in 1 second, and then turn on the power 9 seconds later.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2898Reducing power consumption of a raspberry Pi2014-08-18T11:59:39Z<p>Rijk: </p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [http://www.bitwizard.nl/shop/power-heat/dc-dc-step-down-conv switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2897Reducing power consumption of a raspberry Pi2014-08-18T11:27:43Z<p>Rijk: /* Introduction */</p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [http://bitwizard.nl/shop/power-heat/dc-dc-step-down-conv switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2896Reducing power consumption of a raspberry Pi2014-08-18T11:26:12Z<p>Rijk: </p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [https://bitwizard.nl/shop/power-heat/dc-dc-step-down-conv switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2895Reducing power consumption of a raspberry Pi2014-08-18T10:49:01Z<p>Rijk: </p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [http://shop.bitwizard.nl/power-heat/dc-dc-step-down-conv switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2894Reducing power consumption of a raspberry Pi2014-08-18T10:28:14Z<p>Rijk: </p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [http://www.bitwizard.nl/catalog/product_info.php?cPath=26&products_id=99 switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi&diff=2893Reducing power consumption of a raspberry Pi2014-08-18T10:27:48Z<p>Rijk: </p>
<hr />
<div>= Introduction =<br />
<br />
The Raspberry Pi relies on a linear regulator for its 3V3 rail. This dissipates a third of the energy as heat, which is a bit of a waste, if you want to power your Pi from an battery. Our solution: Replace the linear regulator with a [http://www.bitwizard.nl/catalog/product_info.php?cPath=26&products_id=99 | switching regulator from our shop]. We also used another regulator for the 5V power, to test powering a Pi from a car battery.<br />
[[File:switcher.jpg|none|thumb|300px|alt=One of our switching regulators|One of our switching regulators]]<br />
<br />
= Initial measurements =<br />
<br />
We tuned our benchtop power supply to 12V DC, and set the current-limit to approximately 400mA. Then we adjusted one of the switching regulators to 5V, and labelled it. We gave our Pi an SD card, and ethernet connection. We then hooked up the power to the Pi, on its GPIO header (GND on pin6, 5V on pin2). After booting, the current consumption from the benchtop supply stabilized between 190 and 200mA, which translates to a power consumption of about 2,4W.<br />
<br />
= Slicing the Pi =<br />
<br />
To make sure the linear regulator stopped wasting power, we completely removed it from our Pi, with a hot air rework station. To do this, we grip the regulator with some metal tweezers, lift the Pi about a centimetre, and then blast the regulator with air at about 400 degrees Celsius. After a few seconds, the Pi drops to the table, and the regulator was removed:<br />
[[File:No_LM1117.jpg|none|thumb|300px|alt=There used to be an LM1117-33 at this spot...|There used to be an LM1117-33 at this spot...]]<br />
<br />
= Decorating the Pi =<br />
<br />
We adjusted a second switcher to 3,3V and connected both the 5V and 3V3 switchers to the GPIO header of the Pi (with the benchtop power supply still turned off); 3V3 on pin1, 5V on pin2, GND on pin6.<br><br />
[[File:2regulators.jpg|none|thumb|300px|alt=The two regulators connected to the Pi|The two regulators connected to the Pi]]<br />
The Pi also got the same SD card and ethernet connection as with the initial measurements.<br><br />
We double/triple checked everything, crossed our fingers, and turned on the benchtop supply. After booting, the power consumption settled on 150mA at 12V, a 25% improvement!<br />
[[File:benchtop.jpg|none|thumb|300px|alt=The resulting current draw|The resulting current draw]]<br />
[[File:Final_setup.jpg|none|thumb|300px|alt=The final working setup|The final working setup]]<br />
<br />
= Further reduction =<br />
A further power reduction can be achieved by tying the 5V and 3V3 lines both to the 3.3V DCDC converter (and obviously removing the 5V one). Everything that depends on the 5V will stop working, but most of the 'pi will work. What won't work are devices depending on the 5V powersupply on the GPIO, HDMI and the USB connectors.<br />
<br />
= Conclusion =<br />
<br />
If you're not afraid of modifying your Raspberry Pi, and want to power it from a limited power source, such as a battery or solar panel, it's well worth the trouble and cost of replacing the linear regulator by a switching one. The only downside is that the extra regulator takes up a little extra room.</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2891Raspduino2014-08-11T15:16:36Z<p>Rijk: /* Creating a Project */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
=== Setup ===<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
=== Running the Project ===<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c written in Arduino Wiring can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/wiring-blink/src/main.c here]. An AVR native version is also [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c provided]. More can be found among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2890Raspduino2014-08-11T15:16:07Z<p>Rijk: /* Using PlatformIO */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
=== Setup ===<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c written in Arduino Wiring can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/wiring-blink/src/main.c here]. An AVR native version is also [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c provided]. More can be found among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2889Raspduino2014-08-11T14:54:28Z<p>Rijk: /* Creating a Project */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c written in Arduino Wiring can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/wiring-blink/src/main.c here]. An AVR native version is also [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c provided]. More can be found among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2888Raspduino2014-08-11T14:54:02Z<p>Rijk: /* Creating a Project */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c written in Arduino Wiring can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/wiring-blink/src/main.c here]. An AVR native version is also [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c provided]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2887Raspduino2014-08-11T14:50:01Z<p>Rijk: /* Creating a Project */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blinks the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2886Raspduino2014-08-11T14:49:37Z<p>Rijk: /* Creating a Project */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
And initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blink the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2885Raspduino2014-08-11T14:49:13Z<p>Rijk: /* Using PlatformIO */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
... and initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blink the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2884Raspduino2014-08-11T14:48:09Z<p>Rijk: /* Using PlatformIO */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage].<br />
<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program for the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
... and initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blink the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2883Raspduino2014-08-11T14:46:16Z<p>Rijk: /* Using PlatformIO */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi.<br />
<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program for the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
... and initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blink the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijkhttps://bitwizard.nl/wiki/index.php?title=Raspduino&diff=2882Raspduino2014-08-11T14:46:04Z<p>Rijk: /* Using PlatformIO */</p>
<hr />
<div>[[File:Raspduino_v1.1.jpg|thumb|300px|alt=The Raspduino V1.1|The Raspduino V1.1]]<br />
<br />
This is the documentation page for the BitWizard Raspduino board. The Raspduino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi (some people like to call this a Pi Plate). It is then possible to add Arduino shields to the Raspduino.<br><br />
<br><br />
The Raspduino can be bought in the [http://www.bitwizard.nl/catalog/product_info.php?products_id=126 BitWizard shop].<br />
<br />
= Features =<br />
<br />
* Fully Arduino compatible<br />
* Plugs directly on a Raspberry Pi<br />
* Compatible with (almost) all Arduino shields<br />
* Equipped with an ATmega328 microcontroller<br />
* Upto 8 analog inputs<br />
* Upto 20 digital I/O<br />
* Breaks out the Raspberry Pi's SPI and I2C busses<br />
<br />
= Software Installation =<br />
== Using the Arduino IDE ==<br />
=== Running the Setup Script ===<br />
<br />
To be able to program the Raspduino with the Arduino IDE, you will have to add the board and the Raspberry's serial port to the arduino interface. We have created a script that will automatically apply all settings to get you going.<br />
You can get the script [https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup here].<br><br />
Once you have installed the Arduino IDE, run this script as root (hint: use sudo), and you should be ready to go. You might have to reboot the Raspberry Pi to apply the settings.<br />
<br />
If you're not familiar with linux, these are the commands you can use:<br />
<br />
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup<br />
sudo ./raspduino-setup<br />
sudo reboot<br />
<br />
=== Uploading a sketch ===<br />
<br />
If you have run our setup script, this should be pretty easy. Start up the Arduino IDE on your Raspberry Pi, select the /dev/ttyS0 serial port, and the Raspduino board (currently the bottom one), and hit the "upload" button.<br />
<br />
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] ==<br />
<br />
PlatformIO is a cross-platform code builder and project manager. It is mostly aimed at embedded development. PlatformIO can be run on an Raspberry Pi to program the RaspDuino. The main advantage is that you write both Arduino Wiring code and AVR native code. Also, it is command-line only, which is a plus for a headless Pi<br />
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script [[#Running the Setup Script | For setting up ]] the Arduino IDE.<br />
<br />
Secondly, we need to install [https://pip.pypa.io/en/latest/index.html pip], the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:<br />
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -<br />
Next install PlatformIO and SCons:<br />
sudo pip install platformio && sudo pip install --egg scons<br />
<br />
Next, download the toolchain and programmer (this could take a while):<br />
sudo platformio install atmelavr<br />
Your Raspberry Pi is ready to compile and program for the RaspDuino!<br />
<br />
=== Creating a Project ===<br />
<br />
Create a new empty directory:<br />
mkdir myproject<br />
Change into the newly created directory:<br />
cd myproject<br />
... and initialize a new project:<br />
platformio init<br />
<br />
The project configuration file "platformio.ini" and a folder called "src" are created. <br />
<br />
Edit platformio.ini to look like this:<br />
<br />
[env:atmelavr_raspduino_board]<br />
platform = atmelavr<br />
framework = arduino<br />
board = raspduino<br />
upload_port = /dev/ttyAMA0<br />
# enable auto-uploading<br />
targets = upload<br />
<br />
Put your source files in src/ and run<br />
sudo platformio run<br />
It should compile and program the RaspDuino.<br />
An example main.c that blink the led can be found [https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/atmelavr-native-blink/src/main.c here]. More can be found are in among the [https://github.com/ivankravets/platformio/tree/develop/examples/atmelavr-native-blink project examples]. platformio.ini has to be modified in all cases to work with RaspDuino.<br />
<br />
= Connectors and pinout =<br />
<br />
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br><br />
<br />
== Arduino headers ==<br />
<br />
These are fully compatible with other Arduinos and Arduino-compatible boards. We extended the second digital connector just like on the Arduino Uno, and added the SCL and SDA pins. These are wired in parallel with Analog pins 4 and 5.<br />
<br />
== Raspberry Pi connectors ==<br />
<br />
The Raspberry Pi has two SPI busses, and one I2C bus. Those are (just like on our [[Raspberry_Pi_Serial]] board) broken out to their respective headers, labeled as SPI0, SPI1, and I2C. The signals on these busses are 3V3, but the inputs are 5V tolerant. With the 3V3/5V jumper, you can control what supply voltage is delivered to these connectors. The default setting is 5V.<br />
<br />
== Power input ==<br />
<br />
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.<br />
<br />
== Extra analog connector ==<br />
<br />
The RaspDuino has two extra analog pins (A6 and A7) provided on an extra connector located near the analog pins. The connector also provides ground and 5V (or optionally 3V3).<br />
<table border=1><br />
<tr><td>1</td><td>GND</td></tr><br />
<tr><td>2</td><td>Analog6</td></tr><br />
<tr><td>3</td><td>Analog7</td></tr><br />
<tr><td>4</td><td>V+</td></tr><br />
</table><br />
<br />
= LEDs =<br />
<br />
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.<br />
<br />
= Jumpers =<br />
<br />
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.<br />
<br />
== ICSP/SPI jumper ==<br />
<br />
It is possible to use this connector as an ICSP connector for the AVR, or an SPI connector. By default, this connector is configured as an ICSP connector, but by cutting the trace between the ICSP pad and the center pad, and shorting the center pad to the SPI pad, this connector can be used as an SPI connector. For example to control one of the [[Raspberry_pi_expansion_system_page|BitWizard SPI expansion boards]] from the Raspduino.<br />
<br />
== I2C jumpers ==<br />
<br />
It is possible to connect the Raspberry Pi's I2C bus to the I2C bus of the AVR. To do this, you need to short the SCL and SDA jumpers with a solder bridge.<br />
<br />
== Serial busses voltage selection jumper ==<br />
<br />
The 3V3/5V jumper next to the Raspberry Pi connector controls the voltage supplied to the connectors that break out the Raspberry Pi's SPI and I2C busses. It is possible to run these busses on 5V or 3V3. 5V Is the default setting, but by cutting the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge, you can set the supply voltage to 3V3.<br />
<br />
== AVR voltage selection jumper ==<br />
<br />
It is possible to run the AVR on 5V or 3V3 when the Raspduino is connected to a Raspberry Pi. The default setting is 5V. To set the AVR voltage to 3V3, cut the trace between the 5V pad and the center pad, and connecting the 3V3 pad to the center pad with a solder bridge. Officially the AVR cannot run at 16MHz with 3.3V supply. In practice we haven't seen any problems with running it at 16Mz on 3.3V.<br />
<br />
= Powering the Raspduino =<br />
<br />
You can power the Raspduino in two different ways; By the Raspberry Pi it is plugged into, or if it is used stand-alone, you can connect an external power supply to the "External Power" connector. The supply voltage should be between 7 and 15V. If the voltage is higher than 5V, it will be regulated down to 5V.<br />
<br />
= Future hardware enhancements =<br />
<br />
Suggestions are welcome.<br />
<br />
= Changelog =<br />
<br />
== 1.1 ==<br />
<br />
* Initial public release</div>Rijk