more G-Labs products

Author Topic: Raspberry PI B and Arduino UNO using analogue sensors  (Read 1353 times)

December 11, 2015, 05:40:40 PM
Read 1353 times

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I've managed to connect the Arduino UNO to the Raspberry via USB and successfully ran the blinking light serial test. Now that's working I've got an Arduino smoke sensor and light sensor which I'd like to use. Basically I need to send the readings from both from the Arduino to the Raspberry PI using HG to read the results.

Should I go the Arduino IDE route with a sketch or can I bypass the Arduino sketch and send the raw output to the Raspberry PI/HG for processing

December 11, 2015, 06:51:26 PM
Reply #1

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330

You'll definitely need to edit the arduino code to read the analog inputs and send them over to Pi/HG.  Since you are on Pi you can use the HG arduino sketch editor/loader and skip the Arduino IDE.  Then you'll need to parse the data in HG... read this other conversation in process... http://www.homegenie.it/forum/index.php?topic=1265.0

December 12, 2015, 12:12:57 AM
Reply #2

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I'll try that and report back.

Is there anyone doing much with a Raspberry PI and an Arduino. I'd like to see how good they work together with HG

December 12, 2015, 04:50:52 PM
Reply #3

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I've now connected an Arduini Smoke Sensor shield to the Arduino and ran the Serial I/O program.I'm getting back serial output from the smoke sensor so thats all working.I'd like to incorporate this output into the alarm system to add a fire aspect to it now. Could anyone point me in the right direction on how to achieve this.

December 13, 2015, 01:53:17 AM
Reply #4

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
In the security system program code there is a check for these parameter names:

                || parameter.Name == "Sensor.Smoke"
                || parameter.Name == "Sensor.Heat"
                || parameter.Name == "Sensor.CarbonMonoxide"
                || parameter.Name == "Sensor.CarbonDioxide" )

So if you RaiseEvent like this, I think HG will recognize it as such...
    Program.RaiseEvent(module4, "Sensor.Smoke", ArduinoData, "Smoke"); 


December 13, 2015, 03:54:56 AM
Reply #5

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Thanks for that.

May have hit a problem with adding the smoke sensor shield. I now have an Arduino Uno and a smoke sensor shield piggy backed connected directly to the Raspberry Pi. As a result I've noticed that's the Raspberry PI Camera module CSI is acting a little strange. When I disconnect the Arduino everything is fine. I'm thinking it may be a power supply issue.