IoT Thunderdome [Paraimpu 2]

5. Connecting hardware to Paraimpu

In yesterday’s post I described the basic steps (more so the experience) to get started with Paraimpu.  I did a basic example that required no extra installations or hardware.  Today I want to go further and try hooking up some hardware to the IoT.  For this I have an Arduino UNO R2 hooked up to an LDR:

The procedure to set this up properly has a few prerequisites:

I am doing this on a Bootcamp install of Windows 7 64-bit Pro.

Also, we will need the code to run on the Arduino as well as the python controller which establishes the connection with Paraimpu.  All of this is very well documented on the site and can be found as you are establishing the Arduino as a sensor:

Download and upload the sketch to your Arduino board.  Next Run the controller_sensor.py.  The controller script establishes the connection between the arduino board connected to the pc and Paraimpu.  Once you run it, it will ask you to plug in the arduino board.  For me this meant UNPLUGGING and then plugging back in:

As you can see there was a small hickup because the script did not have httplib defined.  I opened up the script and added this line just below the other imports:

import httplib

Running this again I saw the following:

This will query the board and send values to Paraimpu every minute (configurable in the Arduino code).  Notice that we are getting values for all of the pins though my LDR is only hooked up to A0 on the Arduino.   The documentation for the process does mention that all of the unused pins should be grounded, but I have omitted this step.

On the Paraimpu side you can create an actuator such as getting a tweet when the sensor value is within a certain defined range.

I set up twitter as an actuator once again, and began receiving tweets:

{“D07”: “L”, “D06”: “L”, “D05”: “L”, “D04”: “L”, “D03”: “L”, “D02”: “L”, “D01”: “H”, “D00”: “H”, “D12”: “L”, “D09”: “L”, “D08″: ” @paraimpu

I will wait a bit and see what else comes through.  Seems sending all of the values is a bit too much for twitters 140 character limit.

It is also possible to do this all without the PC if you have an Ethernet shield for the Arduino.  I do and will be looking at how to set this up in an upcoming post.

NOTE: Pause the twitter actuator in Paraimpu, otherwise your computer will spew digital noise at a constant rate!

 



3 Comments

  1. Paraimpu Team wrote:

    Thanks for the detailed post.

    We have just fixed two points you found:
    – the forgotten “import httplib” is now in the “controller_sensor.py” for windows downloaded from Paraimpu
    – more details in the texts showed when the controller runs (i.e. unplug and plug again if board is already plugged)

    Enjoy!

    • lfraguada wrote:

      Thanks for the information! Another thing which came up is that even though I stopped the actuation, the system kept on sending tweets. I had to delete the actuators in Paraimpu to stop sending tweets. Any idea of why that might be? I am setting up an ethernet enabled test here soon, so I will do one more write up on that type of setup.
      Again, thanks!

Leave a Reply