@andriej
Hi, I had problem using the main branch mysensors/Raspberry, that because of the bit-field struct (header_s) in Sensor.h They will get packed in different order on the arduino compared to the RPi (at least with my compiler, gcc). In order to fix this I created the 1.4dev branch. It uses full bytes instead of the bit-fields, but you need (of cause) to compile both the sensors (arduino) and the gateway (RPi) using the 1.4dev branch.
We need to fix this in the main branch later on (and use the same files as in mysensors/Arduino/libraries/MySensors)
Hey!
If you're using ESP32 with LoRa (RFM95) and a Raspberry Pi gateway, here are some quick tips:
Hardware: Heltec ESP32 + LoRa boards work great with MySensors.
Power: ESP32 (~600mA) + LoRa (~120mA) can drain batteries fast—Arduino might be better.
Software: Use Arduino IDE for ESP32 (try EnergyMeterPulseSensor), and set up an MQTT gateway on the RPi. Home Assistant works well for data visualization.
Real-World Tips: MySensors + LoRa is great for farm/weather monitoring—checking similar projects can help.
Well, my network with two handfulls of nodes in three different locations is still live and kicking! I agree that there does not seem to be a lot happening in the community. I'm running 2.4.0- alpha since this gives support for MQTT over TLS. Just managed today to create one more MQTT GW after reading a lot about support for ESP8266. You know, these things you do once per year and have to learn new each time.
MySensors is the cheapest way I have found to create small sensor nodes etc. But now slowly running out of my supply of hardware. Well, time will tell...
It seems you can access the child ID from the sent message by looking at the destination property. If you have the message object, you can extract the ID directly from there.
@ZenBlizzard in case you are measuring the output with a multimeter, you will get an averaged level, since AC current waveform should be sinusoidal and overlapped with the Vcc/2->2.56V in your case.
To measure the current you need a decently high sampling and some math.
#define SENSITIVITY 66 // mV/A
const float readings = 5;
const float alpha = 2.0 / (2 * readings + 1);
for (ifor = 0; ifor < 250; ifor++)
{
// Voltage
voltageSampleRead = analogRead(V) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/
voltageSampleSum = voltageSampleSum + sq(voltageSampleRead); /* accumulate total analog values for each sample readings*/
voltageSampleOffsetSum = voltageSampleOffsetSum + voltageSampleRead;
// Current
currentSampleRead = analogRead(I) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/
currentSampleSum = currentSampleSum + currentSampleRead * currentSampleRead; /* accumulate total analog values for each sample readings*/
currentSampleOffsetSum = currentSampleOffsetSum + currentSampleRead;
wait(1);
}
voltageMean = voltageSampleSum / ifor; /* calculate average value of all sample readings taken*/
voltageOffset = voltageSampleOffsetSum / ifor;
reading = (sqrt(voltageMean) - voltageOffset) * 230.0 / 1.0; // read voltage / reported voltage.
voltage = round_to_dp(alpha * reading + (1 - alpha) * voltage,1);
Serial.println(voltage);
if (voltage < 25) voltage = 0;
currentMean = currentSampleSum / ifor; /* calculate average value of all sample readings taken*/
currentOffset = currentSampleOffsetSum / ifor;
reading = (sqrt(currentMean) - currentOffset) / SENSITIVITY * 1000 - currentZeroOffset; // subtract no load current.
if (reading < 0) reading = 0;
current = round_to_dp( alpha * reading + (1 - alpha) * current,2);