Skip to content
epsilonrt edited this page Oct 2, 2018 · 14 revisions

Arduino on Pi boards, the best of both worlds.

PiDuino was born from a question from one of my students who asked me why programming input-output on NanoPi was not as simple as on Arduino.

PiDuino therefore aims to respond to this need:

An Application Programming Interface (API) on Pi boards as close as possible to that of Arduino.

This API must allow to use GPIO, Serial port, I2C bus and SPI... on Raspberry Pi, Nano Pi,Orange Pi, Banana Pi, Beagle Board... boards as on an Arduino board.

What PiDuino offers:

  • A programming interface API same as Arduino except adding #include <Piduino.h>at the beginning of the program. It does not prohibit offering extensions of the API but provided that stay as independent as possible from the platform and not to make the code incompatible with Arduino. It makes sense to think that users who want to stay in the Arduino world use C ++, PiDuino is intended for this use case. Nevertheless some functions can be used in C (pinMode (), digitalWrite (), ...).

  • The description of Pi boards that is based on an "Object" model stored in a database (SQLite by default), allowing a simple user to add a new Pi board "variant" WITHOUT programming.

  • An object design in C++ with a clear separation of the part specific to the platform. Support for new SoCs is summarizes to add a part "driver" in the directory src/gpio/arch

  • Utilities for manipulating GPIO signals: pido, retrieve information from the board: pinfo or manage the Pi boards database: pidbman

PiDuino is in development, version 0.3 currently but the completed parts are functional on Broadcom SoC BCM283X and AllWinner Hx.

The list of models present in the database is as follows:

  • NanoPi Core
  • NanoPi Core with Mini Shield
  • NanoPi Core2
  • NanoPi Core2 with Mini Shield
  • NanoPi M1
  • NanoPi M1+
  • NanoPi Neo
  • NanoPi Neo 2
  • NanoPi Neo Air
  • NanoPi Neo+ 2
  • RaspberryPi 2
  • RaspberryPi 3
  • RaspberryPi A
  • RaspberryPi A+
  • RaspberryPi B
  • RaspberryPi B+
  • RaspberryPi Compute Module
  • RaspberryPi Compute Module 3
  • RaspberryPi Zero
  • RaspberryPi Zero Wifi

Road Map

What was done ?

  • GPIO modeling, GPIO connectors and pins
  • Creation of database model and addition of all variants of Raspberry Pi, Nano Pi Neo, Neo2, Neo Plus 2, M1, M1 Plus.
  • Creation of SoC access layers for Broadcom BCM283X and AllWinner Hx.
  • Creating pido and pinfo utilities
  • Switching iomap in C++
  • Creating virtual classes IoDevice and FileDevice
  • analogWrite() with GPIO software PWM feature (Polling with thread)
  • Emulate setup() and loop() for Arduino compatibility (in Arduino.h)
  • Cleaning the architecture detection
  • I2C Bus API
  • SPI Bus API
  • Serial Port API
  • Arduino Classes (String, Print, Stream....)
  • Update README

The rest of the things to do:

  • pidbman for managing the database of boards with Qt (in development pidbman)
  • Enabling daemon mode for loop()
  • Hardware PWM Pin support
  • analogWrite() with Software PWM feature (Kernel driver module)
  • analogWrite() with external DAC (IIO)
  • analogRead() with external ADC or Sensor (IIO)
  • Man Pages for Utilities
  • Database Doxygen Documentation (English)
  • Creating a web page
Clone this wiki locally