This project solves the Space Apps 2013 Ardusat challenge by using a Raspberry Pi running ChibiOS, a Real Time Operating System for embedded systems, to emulate serveral Arduino boards.
Inside ChibiOS threads runs Arduino code with help of a library that mimics the Arduino platform. The RTOS can be configured to map pins and devices betwen the Raspberry Pi and the virtual Arduinos allowing the maximum use of the sensors in Ardustat. The code and configuration running on the Raspberry pi can be uploaded via serial console for remote management.
In the global judging round of the Space Apps Challenge 2013 this project received an Honorable Mention for Best Use of Hardware.
In MAC OS X you can use Yagarto and in Linux you can use yol.
git clone https://github.com/steve-bate/ChibiOS-RPi
git clone https://github.com/manuel-rabade/arduino-chibios-rpi
cd arduino-chibios-rpi && make
cd arduino-chibios-rpi/bootloader && make
Copy arduino-chibios-rpi/bootloader/kernel.img
to the SD
card. Download bootcode.bin and
start.elf and copy them to
the SD card.
Install minicom and configure it:
Serial Device : /dev/ttyUSB0
Bps/Par/Bits : 115200 8N1
Hardware Flow Control : No
Software Flow Control : No
Power your Raspberry Pi and upload arduino-chibios-rpi/build/ch.bin
using XModem.
Once ChibiOS has been uploaded the following commands are available in the serial shell:
Virtual Arduinos status
ch> status
Pause operation of a virtual Arduino
ch> pause [arduino #]
Resume operation of a virtual Arduino
ch> resume [arduino #]
Retrive serial buffer of a virtual Arduino
ch> log [arduino #]
Memory usage
ch> mem
Threads status
ch> threads
ChibiOS build information
ch> info
System time
ch> systime
Reboot
ch> reboot
This project map the following Raspberry Pi pins to virtual Arduino pins:
Raspberry Pi Virtual Arduino Arduino pin
GPIO22 arduino0 13
GPIO7 arduino1 13
GPIO25 arduino1 12
GPIO17 arduino2 13
GPIO24 arduino3 13
arduino-chibios-rpi/main.cpp
it's the entry point that spawns the
threads.
arduino-chibios-rpi/arduino/arduino0.cpp
,
arduino-chibios-rpi/arduino/arduino1.cpp
,
arduino-chibios-rpi/arduino/arduino2.cpp
and
arduino-chibios-rpi/arduino/arduino3.cpp
are the code for each
virtual Arduino.
arduino-chibios-rpi/arduino-chibios-rpi/arduino/arduino0.h
,
arduino-chibios-rpi/arduino/arduino1.h
,
arduino-chibios-rpi/arduino/arduino2.h
and
arduino-chibios-rpi/arduino/arduino3.h
are the configuration for each
Arduino.
arduino-chibios-rpi/arduino/arduino.h
and
arduino-chibios-rpi/arduino/arduino.cpp
is the library that emulates
the Arduino plataform.
- ChibiOS-RPi port and demos by Steve Bate
- Raspberry Pi bootloader by David Welch
- Arduino languaje reference
- Arduino source code
- Raspberry Pi Low-level peripherals
Manuel Rábade <manuel@rabade.net>
This work is published under a Simplified BSD License.