Difference between revisions of "Raspduino"
(22 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
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> |
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> |
||
The Raspduino can be bought in the [http://www.bitwizard.nl/ |
The Raspduino can be bought in the [http://www.bitwizard.nl/shop/avr-boards/raspduino BitWizard shop]. |
||
= Features = |
|||
* Fully Arduino compatible |
* Fully Arduino compatible |
||
Line 15: | Line 15: | ||
* Breaks out the Raspberry Pi's SPI and I2C busses |
* Breaks out the Raspberry Pi's SPI and I2C busses |
||
= Software Installation = |
|||
⚫ | |||
== Using the Arduino IDE == |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
If you're not familiar with linux, these are the commands you can use: |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=== Uploading a sketch === |
|||
⚫ | |||
== Using [http://docs.platformio.ikravets.com/en/latest/index.html PlatformIO ] == |
|||
⚫ | |||
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. |
|||
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. |
|||
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: |
|||
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python - |
|||
For more information about pip, refer to the [https://pypi.python.org/pypi/pip homepage]. |
|||
Next install PlatformIO and SCons: |
|||
sudo pip install platformio && sudo pip install --egg scons |
|||
Next, download the toolchain and programmer (this could take a while): |
|||
sudo platformio install atmelavr |
|||
Your Raspberry Pi is ready to compile and program the RaspDuino! |
|||
=== Creating a Project === |
|||
Create a new empty directory: |
|||
mkdir myproject |
|||
Change into the newly created directory: |
|||
cd myproject |
|||
And initialize a new project: |
|||
platformio init |
|||
The project configuration file "platformio.ini" and a folder called "src" are created. |
|||
Edit platformio.ini to look like this: |
|||
[env:atmelavr_raspduino_board] |
|||
platform = atmelavr |
|||
framework = arduino |
|||
board = raspduino |
|||
upload_port = /dev/ttyAMA0 |
|||
# enable auto-uploading |
|||
targets = upload |
|||
=== Running the Project === |
|||
Put your source files in src/ and run |
|||
sudo platformio run |
|||
It should compile and program the RaspDuino. |
|||
An example blinky program written in Arduino Wiring can be found [https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino/arduino-blink/src here]. An AVR native version is also [https://raw.githubusercontent.com/platformio/platformio-examples/develop/atmelavr-and-arduino/atmelavr-native-blink/src/main.c provided]. More can be found among the [https://github.com/platformio/platformio-examples/tree/develop/atmelavr-and-arduino project examples]. platformio.ini has to be modified in all cases to work with RaspDuino. |
|||
⚫ | |||
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br> |
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.<br> |
||
== Arduino headers == |
|||
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. |
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. |
||
== Raspberry Pi connectors == |
|||
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. |
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. |
||
== Power input == |
|||
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi. |
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi. |
||
== Extra analog connector == |
|||
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). |
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). |
||
Line 41: | Line 103: | ||
</table> |
</table> |
||
= LEDs = |
|||
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13. |
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13. |
||
= Jumpers = |
|||
The |
The Raspduino has a number of jumpers, to configure it for multiple different scenarios. |
||
== ICSP/SPI jumper == |
|||
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 |
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. |
||
== I2C jumpers == |
|||
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. |
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. |
||
== Serial busses voltage selection jumper == |
|||
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. |
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. |
||
== AVR voltage selection jumper == |
|||
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. |
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. |
||
= Powering the Raspduino = |
|||
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. |
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. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
== |
== 1.1 == |
||
⚫ | |||
⚫ | |||
⚫ | |||
== Useful links == |
|||
⚫ | |||
[http://www.bitwizard.nl/shop/avr-boards/raspduino The Raspduino BitWizard shop page] |
|||
⚫ | |||
⚫ | |||
⚫ |
Latest revision as of 14:14, 11 August 2016
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.
The Raspduino can be bought in the BitWizard shop.
Features
- Fully Arduino compatible
- Plugs directly on a Raspberry Pi
- Compatible with (almost) all Arduino shields
- Equipped with an ATmega328 microcontroller
- Upto 8 analog inputs
- Upto 20 digital I/O
- Breaks out the Raspberry Pi's SPI and I2C busses
Software Installation
Using the Arduino IDE
Running the Setup Script
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.
You can get the script here.
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.
If you're not familiar with linux, these are the commands you can use:
wget https://raw.github.com/rewolff/raspduino_tools/master/raspduino-setup sudo ./raspduino-setup sudo reboot
Uploading a sketch
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.
Using PlatformIO
Setup
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.
First, the serial console on /dev/ttyAMA0 should be disabled. If you dont know how to do so, run the script For setting up the Arduino IDE.
Secondly, we need to install pip, the Python package manager. Since the version in the Raspbian repos is too old, we need to install from the internet:
wget -O- -q https://bootstrap.pypa.io/get-pip.py |sudo python -
For more information about pip, refer to the homepage.
Next install PlatformIO and SCons:
sudo pip install platformio && sudo pip install --egg scons
Next, download the toolchain and programmer (this could take a while):
sudo platformio install atmelavr
Your Raspberry Pi is ready to compile and program the RaspDuino!
Creating a Project
Create a new empty directory:
mkdir myproject
Change into the newly created directory:
cd myproject
And initialize a new project:
platformio init
The project configuration file "platformio.ini" and a folder called "src" are created.
Edit platformio.ini to look like this:
[env:atmelavr_raspduino_board] platform = atmelavr framework = arduino board = raspduino upload_port = /dev/ttyAMA0 # enable auto-uploading targets = upload
Running the Project
Put your source files in src/ and run
sudo platformio run
It should compile and program the RaspDuino. An example blinky program written in Arduino Wiring can be found here. An AVR native version is also provided. More can be found among the project examples. platformio.ini has to be modified in all cases to work with RaspDuino.
Connectors and pinout
The Raspduino of course has the same connectors and pinout as a regular Arduino, and some extra connectors.
Arduino headers
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.
Raspberry Pi connectors
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.
Power input
It is possible to connect an external power supply on these pins, in case you want to use your Raspduino without a Raspberry Pi.
Extra analog connector
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).
1 | GND |
2 | Analog6 |
3 | Analog7 |
4 | V+ |
LEDs
The Raspduino has two LEDs: A power indicator, and a LED connected to digital pin 13.
Jumpers
The Raspduino has a number of jumpers, to configure it for multiple different scenarios.
ICSP/SPI jumper
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 BitWizard SPI expansion boards from the Raspduino.
I2C jumpers
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.
Serial busses voltage selection jumper
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.
AVR voltage selection jumper
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.
Powering the Raspduino
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.
Future hardware enhancements
Suggestions are welcome.
Changelog
1.1
- Initial public release