You are here

Arduino (Drupal Module)

Submitted by edwbaker on Thu, 2014-05-29 12:45

Project to post from an Arduino to a Drupal website, mainly for publishing data in real time collected from sensors attached to the Arduino.

Aims of the :

  • Provide token based authentication for an Arduino device to post to a single content type on a Drupal site. A single Arduino could act as a number of virtual devices posting to different content types.
  • Automatically generate Arduino code for posting to the site. For the relevant content type create a struct that mirrors the fields in that content type, paying attention when possible to using the most efficient C type (e.g. for an integer with minimum and maximum values set correctly identifying whether to use int or long, signed or unsigned). There will also be a function that accepts the struct and token and POSTs them to the website.

Longer term goals:

  • Offline data storage. The Arduino Ethernet shield has a microSD card that could be used to store data when an internet connection cannot be made. The POSTing function should be modified to write to the card if this is desired for subsequent transmission. When an Ethernet connection becomes available the Arduino can then submit the content an intervals to the Drupal site. Some thought needs to be put into how the timing of data will be controlled. If an RTC chip is available the time can be logged, otherwise we might store the value of millis() for each request. We could then signal to Drupal when a request is made asynchronously and it could calculate the correct time based on the last online submission's value of millis().
  • Sending commands to devices. Implementing a web server on the devices would allow Drupal to request functions from the devices using HTTP. This would also allow devices to request functions from each other. Using HTTP allows for other devices to easily participate in such a network. Drupal could be used to perform processing-heavy functionality, or as a scheduler.


Start Year: 

All content by +Ed Baker