Same here. It's easy. I use it mostly for the battery status. It's the only red value on my mirror, at least, when they're almost drained.
![](/uploads/profile/921-profileimg.jpg)
hetbeest
@hetbeest
Best posts made by hetbeest
Latest posts made by hetbeest
-
RE: Magic mirror
-
RE: Sensebender Micro
In Domoticz I also see sensors hemidity and sensors temperature with the type LaCrosse TX3. Does anyone know what they are?
-
RE: Sensebender Micro
My two have arrived, up and running in Domoticz as WTGR800 temp + hum.
-
RE: Sensebender Micro
Does it need a FTDI USB to TTL Serial Adapter to upload sketches?
-
RE: IR distance sensor usage?
I did some quick coding, combining it with a temperature sensor. It did work for a couple of hours, after that my 9V battery was drained so far that I didn't get any data send from the sensors anymore. Quite likely the IR sensor uses a lot of power while it keeps transmitting IR. Anyhow, my quick and dirty code is:
// Example sketch showing how to send in OneWire temperature readings
#include <MySensor.h>
#include <SPI.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <DistanceGP2Y0A21YK.h>#define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
#define MAX_ATTACHED_DS18B20 16
#define CHILD_ID_DISTANCE 25
DistanceGP2Y0A21YK Dist;
unsigned long SLEEP_TIME = 500; // Sleep time between reads (in milliseconds)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
MySensor gw;
float lastTemperature[MAX_ATTACHED_DS18B20];
int numSensors=0;
boolean receivedConfig = false;
boolean metric = true;
int distance;
int lastDistance=0;
int loopCounter=0;
int loopsBetweenTemp = 60;// Initialize temperature message
MyMessage msg(0,V_TEMP);
MyMessage msgdist(CHILD_ID_DISTANCE,V_DISTANCE);void setup()
{
// Startup OneWire
sensors.begin();
Dist.begin(0);// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin();// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature and Distance Sensor", "1.0");
gw.present(CHILD_ID_DISTANCE,S_DISTANCE);
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();// Present all sensors to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
gw.present(i, S_TEMP);
}
}void loop()
{
// Process incoming messages (like config from server)
gw.process();distance = Dist.getDistanceCentimeter();
if (distance != lastDistance) {
lastDistance = distance;
gw.send(msgdist.set(distance));
}if (loopCounter == 0) {
// Fetch temperatures from Dallas sensors
sensors.requestTemperatures();// Read temperatures and send them to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Only send data if temperature has changed and no error if (lastTemperature[i] != temperature && temperature != -127.00) { // Send in the new temperature gw.send(msg.setSensor(i).set(temperature,1)); lastTemperature[i]=temperature; } }
}
if (++loopCounter >= loopsBetweenTemp) loopCounter = 0;
gw.sleep(SLEEP_TIME);
} -
RE: IR distance sensor usage?
Thanks. I'll have a look and surely will post my version.
-
IR distance sensor usage?
Hi all,
I'm pretty new to mysensors, although I read a lot. I bought an IR distance sensor, the Sharp GP2Y0A21YK0F GP2Y0A21 10~80cm Infrared Proximity Distance Sensor, but I don't know how to connect it? Anyone any idea? Maybe also an example sketch?
Thanks,Evert