Back to top

A demo for open hardware meeting open software: Arduino + Android + Drupal

A few years ago, when the Android just came out, I did a project Drupal + Services Module + Beer = BeerCloud on Android and iPhone. Now, I feel it's the time to bring this open vertical integration even further to complete an open ubiquitous computing model or tech stack. The previous project stack has already covered OS, Database, Web Server, CMS, Mobile Device; for this new project, let's bring wearables or sensors into the picture.

At HackYiZu 2013 event, Shanghai, China, my colleague Jerenus Zheng and I wanted to build a concrete example to demo the idea above as well as showing the power of each open component. Therefore, we came up with the detailed plan below:

      1. Connect a sound sensor with Arduino
      2. Connect either/both Bluetooth Low Enegry module or/and NFC module to the Arduino
      3. Use BLE or NFC to stream the sound data to an Android 4.0+ device
      4. Build an app on the Android device to send the data to Drupal
      5. Use Views and Charts modules on Drupal to visualize the sound data collected during the event

    The complete software/hardware stack for this project is below:

    We spent about 15 hours on debugging Bluetooth Low Enengry on the Bluno board as well as the demo app provided by the hardware vendor (This part could be much shorter, but we didn't detect the impact of an unstable power supply from a USB until very late). Because we needed to catch up the deadline of the event and we already spent most of time on BLE, therefore we couldn't get time to use NFC module. Then, we used about 20 minutes to connect all the parts together and to prepare the presentation for the event. The final hardware part (excluding my phone Nexus 5) is below:


    On the other hand, regarding the software, first we wrote a simple loop, using Arduino IDE to collect sound level (decibel) every half a second (the code can be found on Analog Sound Sensor documentation), then broadcasting this data using BLE (the sample code can be found on Bluno documentation). Then, we modifed the sample app provided by Bluno to create our demo app and added some DrupalCloud sample code to forward the data to the Drupal Services. On the Drupal side, we created a Content Type called "Bluno" and one Integer field for storing decibel. So, whenever our demo app receives the decibel number (about half a second), it calls DrupalCloud to create a node with decibel number on Drupal via Services. Finally, we created a simple Views with Chart display format to visualize all the bluno nodes.

    We explained the idea at our presentation of the event, and made people screaming/cheering for a while, therefore a nice graph was generated below:

    Due to the limited time, we couldn't make our demo code nice enough to publish online. But, this project has been fun, and we are looking forward to creating a useful or meaningful project based on the idea above, also to publishing an open source library to deal with new connectivity (BLE or NFC) on Arudino. I hope this blog can envision us with openness of the hardware and software as well as the open connecitivty between them.

    * We thank Techyizu for organizing HackYiZu 2013 event and thank DFRobots and other sponsors for sponsoring the hardware.

    Comments

    GCM, drupal and android connection

    Comment: 

    Hi.

    Great post, but i have some question:
    How i can connect drupal with CDM and how i can connect drupal with the Drupal cloud library, How is the connection beetween drupal site, CDM and android

    Add new comment