• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Arduino VirtualWire library port to pilight
#1
Using 2 Arduino Megas (one remote sensor and one receiver - communicating via RF433) I developed a weather station running with multiple sensors (temp, light, humidity, air pressure, ..).
Data is uploaded to Xively every minute. It's working stable for a couple of months.

I'm using the following RF433 library on the Arduinos:
Code:
#include <VirtualWire.h>

Receive a message and decoding it is quite easy:
Code:
void Process_RF433 ()
  {
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    int i;  
    char Chars[buflen];
    for (i = 0; i < buflen; i++)
    {
      Chars[i]  = char(buf[i]); //from buffer to Char Array
    }
    // Serial.println(Chars); //Debug only
    Decode(Chars); //Send to decoder = function Decode
    }
}
Now I want to use pilight to receive (and process) the Arduino sensor data as well and do some magic with it. Wink
Of course I could (try to) port the VirtualWire library to pilight, but my programming skills are not that good. And perhaps someone already did something similar?!
Do you have any tips or tricks?
 
Reply
#2
I also have a energy monitor made with arduino based on the energy monitor project and i dont know how can i pass to pilight de data.
virtualwire receiver with label display it is important to implement in pilight, because give other possibilities.

Question for CurlyMo:
Actualy How can we send data not on off from arduino to pilight via lowcost rf433?
 
Reply
#3
By creating a custom protocol.
 
Reply
#4
Curlymo,as a specialist on protocols are you able develop as a base a generic_virtualwire _ receiver to decode the protocol.8
When the string is received you can identify :
First bytes the device id and the rest the data.
The you can display as label.
This it is simple and useful.
 
Reply
#5
I got it working using the http API! Smile

The Arduino sends its sensor data to pilight via a:

Code:
http://......:5001/send?{"action....
call to a generic_weather station in pilight.

Or more precise: this is what I send every 1 minute from the arduino:
Code:
{
    "action": "control",
    "code": {
        "device": "arduinogarage",
        "values": {
                        "temperature": 99.00,
            "humidity": 99.00,
            "battery": 1
        }
    }
}

In my config.json I have added this device:
Code:
"arduinogarage": {
        "protocol": [ "generic_weather" ],
        "id": [{
            "id": 400
        }],
        "temperature": 99.00,
        "humidity": 99.00,
        "battery": 1
    }
}

It is somewhat limited because I can only send temp, humidity and battery values.
I also need to put airpressure and light values somewhere!?
Any ideas?
 
Reply
#6
You would have to create a custom protocol or modify the generic_weather protocol to also include data for air pressure and light.
 
Reply
#7
Interesting: this is similar to the solution presented by CurlyMo!!
http://forum.pilight.org/Thread-api-does...led?page=2
 
Reply
#8
But you got the codes for the send page right, what you need is a modified version of the generic_weather protocol so you can also use your other sensors with pilight to be able to send the data that you have.
 
Reply
#9
Yes, correct. At the moment I misusing several generic_weather devices to carry the extra info!
 
Reply
#10
If you know a bit of C you could probably try to take a shot at improving the generic_weather protocol (I would but I don't know C very well). But that belongs in a different thread Wink
http://forum.pilight.org/Thread-Generic-weather might be a good thread to post about it.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  MQTT protocol for pilight Chekov 11 4,777 11-03-2018, 04:21 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)