Skip to content

manuel-rabade/arduino-chibios-rpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduinos on the Raspberry Pi

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.

Build & Run

1. Wire the prototype

Schematic

2. Install the GNU ARM toolchain

In MAC OS X you can use Yagarto and in Linux you can use yol.

3. Get ChibiOS for the RPi

git clone https://github.com/steve-bate/ChibiOS-RPi

4. Get Arduinos on the Raspbery Pi

git clone https://github.com/manuel-rabade/arduino-chibios-rpi

5. Build

cd arduino-chibios-rpi && make
cd arduino-chibios-rpi/bootloader && make

6. Setup SD card

Copy arduino-chibios-rpi/bootloader/kernel.img to the SD card. Download bootcode.bin and start.elf and copy them to the SD card.

7. Serial console

Install minicom and configure it:

Serial Device : /dev/ttyUSB0 
Bps/Par/Bits : 115200 8N1
Hardware Flow Control : No
Software Flow Control : No

8. Boot

Power your Raspberry Pi and upload arduino-chibios-rpi/build/ch.bin using XModem.

Serial console

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

I/O configuration

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

Hack

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.

Prototype

Prototype

Videos

References

Author

Manuel Rábade <manuel@rabade.net>

License

This work is published under a Simplified BSD License.

About

Proof of concept that threads in a RTOS for the Raspberry Pi can emulate various Arduinos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published