I've got a few of these with 2xAAA, Arduino pro + radio + DS18b20 crammed into them
@mvdarend has my vote though... much cheaper and fun
I've got a few of these with 2xAAA, Arduino pro + radio + DS18b20 crammed into them
@mvdarend has my vote though... much cheaper and fun
It drives me crazy! The oldest part of the house pre-dates 1650 and was built to last. I have 4 wifi points hard-wired in as wifi will only reach the next room.
On the plus side, it's cool in summer and warm in winter
How odd? Turned off and on... (which I'd tried obviously) and has worked perfectly since
go figure
Ah... actually it doesn't work
It takes one temp reading and then sits there with a led flashing... damn!
Anyone see the problem?
Ok... I tried this based on the standard dallas DS18B20 sketch and I think it's working.
It shows up in MSController as both a TEMP sensor and an ARDUINO_RELAY
Tomorrow I'll try it with Domoticz
Many thanks for the advice
#include <MySensor.h>
#include <SPI.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
#define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
#define MAX_ATTACHED_DS18B20 16
unsigned long WAIT_TIME = 300000; // Wait time between reads (in milliseconds)
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
MySensor gw;
float lastTemperature[MAX_ATTACHED_DS18B20];
int numSensors=0;
boolean receivedConfig = false;
boolean metric = true;
// Initialize temperature message
MyMessage msg(0,V_TEMP);
void setup()
{
// Startup up the OneWire library
sensors.begin();
// requestTemperatures() will not block current thread
sensors.setWaitForConversion(false);
// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin(NULL, AUTO, true);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature Sensor", "1.1");
// 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();
// Fetch temperatures from Dallas sensors
sensors.requestTemperatures();
// query conversion time and sleep until conversion completed
int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
// sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
gw.wait(conversionTime);
// 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 COMPARE_TEMP == 1
if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
#else
if (temperature != -127.00 && temperature != 85.00) {
#endif
// Send in the new temperature
gw.send(msg.setSensor(i).set(temperature,1));
// Save new temperatures for next compare
lastTemperature[i]=temperature;
}
}
gw.wait(WAIT_TIME);
}
Thanks for the reply!
I got my "Arduino for Dummies" book from Amazon today... sooo let's give it a go
Hi Guys,
I have several nodes up and running which I feed into Domoticz.
I'm currently trying to turn the DallasTemperatureSensor script into a repeater node. I have built some plug-in temp sensors but I have range issues due to living in a "Faraday Mansion". Some of my internal walls are 700mm+ in thickness! My current "get around" is to have a Raspberry Pi + Arduino gateway connected to each wifi point (yeah wifi is a huge issue too!)
So far I have
gw.begin(NULL, AUTO, true);
in the
void setup()
and I'm calling process() in my loop()
But I don't know where to go with regard to sleep/wait etc.
I'd like to take a temp reading every 10 - 15 mins but I'm stuck
Any pointers?
@tekka WOW! I thought that was going to be SO difficult... but it took 10mins total! Thank you very much... I'm good to go
Hi Tekka,
Great tool and SO useful for debugging.
I have MYSController running under Wine on Linux Mint with no problems.
I do have one small issue though. I have a serial gateway that reports to Domoticz on my Mint PC. This works fine and MSController connects fine. When I tried to move my gateway to a remote installation of Domoticz on a Raspberry Pi (same network) MSController cannot see it if I try to connect by TCP. I hope it's just something silly like port no. or something, but any ideas?
Many thanks