@Yveaux pff, it's clean room ESD class!
Posts made by Damme
-
RE: Your workshop :)
@Samuel235 It would be possible, I am planning to implement a GPS, and wireless information would be really nice, 'Hi! I'm stuck at XXXX'
There is a small problem though, not enough IO's, so we probobly need to hack and add one more CPU (atmega? that uses the 8 io to the keypad and send data serially between the cpu's (decoding keypad in atmega, send seriell, and tada 7 free io's! Plenty enough for wireless chips!
regarding GPS I think I can use the built in USB in the battery compartment, no major mod required for it.
-
RE: Your workshop :)
Hello everyone!
It's fun seeing this thread alive again!
Sorry I havn't been here for a long while, in the picture you'll see what have been keeping me occupied.. (the orange lawn mower, I'm reverse-engineering it!) and I also moved over from Arduino, atmega328p to esp8266 devices and more advanced cpu's (arm, cortex etc) and 'real' build enviroments..
If there is any interest in my project, https://hackaday.io/project/6717-landlord
The picture pretty much explains how my brain works.. I really need to clean up, might add another picture after that. Behind the mower two rigol devices are hiding, a scope and a p-psu.
-
RE: Which Lab Power Supply?
I like this one, It's not fanless but hackable and 3 channels; http://www.meilhaus.de/en/rigol+dp832,i2.htm
-
RE: Node Child and MQTT Subscribe
I have been away for a while but it seams quite some of you are experiencing problems, I'll try to take a look at it. If you find any more details, please let me know!
-
RE: MQTT Broker gateway
I just wanted to say hello again to everyone. I had to disappear for a while. Just had too much for my brain to handle. So all my automation project were on halt but will be continued again.
I know there are lot of bugs in this GW and I will hopefullt start developing soon again. Just write your experience you had so far and I'll try to keep up
//Damme
-
RE: MQTT Broker gateway
@John Could you send me log from MQTTgateway also? (or tcpdump)
-
RE: MQTT Broker gateway
@adrianmihai83 Sketch-name was a bug that I fixed in development branch, thought @hek updated master branch also. I can post the fix later on in here.
-
RE: MQTT Broker gateway
@adrianmihai83 "home/openHAB/out/Temperature_GF_Corridor/state" is probobly long string, 47 chars. I have not investigated exacly how long it can be but keep it short. And the adress layout is also wrong, is should be something like MyMQTT/21/1/V_LIGHT . MQTTGateway is not compatible with the mosquitto broker you're using.
-
good and safe AC/DC adapter?
Hey guys!
I was thinking about AC/DC adapters. And you all should know about safety of using cheap chinese one's. They can actually kill you if they are bad built... So my thought was to test a couple of different one's and look inside them. Right now I use old AC/DC 5v adapters with 5mm plug from old routers and stuff so they should be all ok..
But I don't know if someone already did some research of this? I was mainly looking at adapters with a round 5mm plug, and not USB but I know some of you are using USB adapters too.
Lets gather photos of adapters in this thread!
//Damme
-
RE: MQTT Broker gateway
@John then node is started, There was a bug not processing that message which is fixed now.
hasn't been pulled to official yet but can be found at https://github.com/Damme/MQTTGateway/commit/f10843f5efd9c37900624fe57275be11c69e3942 -
RE: problem with sending sketch names to controllers
@goose I've fixed this bug, I will do some tests tomorrow before I upload the changes.
-
RE: MQTT Broker gateway
@John 'started' is only a internal log message, I've changed how that part works.
I've also fixed a couple of bugs and will test the changes tomorrow before I publish them.
New functionallity there user can choose of MQTT should translate ID to V_TYPE or not too. -
RE: problem with sending sketch names to controllers
@goose I'm a bit busy atm but I'll look at it later!
-
RE: Over the air updates
I had to put my project in the trash bin.. There is not enough RAM in the atmega328 to fit mysensors and SD-lib Tried 3 different versions..Too bad..! I could only transmit one package before SRAM got overrunned.
-
RE: Reliability?
@ServiceXp Now when you sayit... I had a wireless mouse that lowerd my reception. A cheap brand, I did't like it and everytime a sensor transmitted the mouse got laggy.
-
RE: Arduino Mini Pro 5v - how to power
@ddluk I run my 5v 16mhz at 3.3v.. Direcly off 2 AA batteries too (I think the reported voltage last I checked was 2.88v, Still works just fine. (But I have flashed bootloader to disable brownout voltage)
-
RE: Reliability?
@ServiceXp One major stability change I did was using shorter wire bewteen radio and arduino.
-
RE: Over the air updates
@ToSa I finally figured out why my OTA bootloader didn't read any answers from my GW (Both on I_FIND_PARENT and I_ID_REQUEST) - The answers came to quick! First I tried hardcode a delay 125ms on the GW and it worked, so I changed the code on send write to the following and now all messages arrive. Been testing it for a couple of reboots now. I'm using 5v (at 3.3v) and 16MHz
edit; noticed it misses packages sometimes now but not close to 100% like before, more like 5% now. I'llinvestigate futher then I'm trying to upload data.static uint8_t sendAndWait(uint8_t reqType, uint8_t resType) { msg.type = reqType; for (uint8_t i = 0; i < 10; i++) { sendWrite(msg); for (uint8_t j = 0; j < 20; j++) { for (uint8_t j = 0; j < 100; j++) { uint8_t pipe; boolean avail = available(&pipe); wdt_reset(); if (avail && pipe<=6) { read(rmsg.array,pipe); if(!(mGetVersion(rmsg) == PROTOCOL_VERSION)) continue; if (rmsg.destination == nc.nodeId) { if (mGetCommand(rmsg) == C_INTERNAL) { if (rmsg.type == I_FIND_PARENT_RESPONSE) { if (rmsg.data[0] < nc.distance - 1) { nc.distance = rmsg.data[0] + 1; nc.parentNodeId = rmsg.sender; eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, nc.parentNodeId); eeprom_write_byte((uint8_t*)EEPROM_DISTANCE_ADDRESS, nc.distance); } } } if ((mGetCommand(rmsg) == mGetCommand(msg)) && (rmsg.type == resType)) return 1; } } delaym(1); } } } return 0; }
-
RE: MQTT Broker gateway
@Zeph but soon there will be a choise to translate v_ to text string or keep it as a byte value
-
RE: MQTT Broker gateway
@ToSa I'll update mqtt later with option to not translate V_TYPE into name string but to keep it as a byte, that would save a lot of memory and might solve problem you have. I'll keep you posted
-
RE: MQTT Broker gateway
@John upon node startup it translates gw.sendSketchInfo("Battery Meter", "1.0"); into MyMQTT/20/255/V_SKETCH_NAME and version
so you could have a list as in my first post and it would get filled up with all your sketch names
@John ; Yes and I hope so (I might have missed some stuff, I do not take regard of QOS etc)
if its not working,, I'll try to fix it -
RE: MQTT Broker gateway
@John That was my first aproach, and I might set a define configuration to choose if the MQTT gateway should translate or not. As you say, the footprint would be much smaller.
Might be next version of the MQTT, slectable address layout -
RE: MQTT Broker gateway
@John About Presentation ; My idea was that next version of the variable system I will either store some bytes in the MQTT gateway about what S_types to V_types, or hopefully the next protocol contains both those so the GW doesnt have to remember. And then add an extra directory to the MQTT path ( MyMQTT/[0-255]/[0-255]/S_[STRING]/V_[STRING]/[VALUE]
-
RE: MQTT Broker gateway
@John No worries!
Presentation is On Todo.. Or Rather To think About list is presentation . I dont do anything with that as it is (Just ignores it). I havn't had any good idea for that yet.Internal is nothing more or less, it connects and set a variable that it is connected. But sure, there could be transport for internal messages also.
I do have an experimental version there I can send internal messages to reboot node, reboot gateway and set clear read eeprom values. (over mqtt-protocol) but this s not finnished yet.. Ideas are welcome! -
RE: MQTT Broker gateway
@John MyMQTT/[0-255]/[0-255]/[STRING]/[VALUE]
MQTT.cpp :
sprintf(&buffer[buffsize],"/%i/%i/V_%s", msg.sender, msg.sensor, getType(convBuf, &vType[msg.type]));
note V_%s -> MyMQTT/[0-255]/[0-255]/V_[STRING]/[VALUE]
also note there is no trailing / before payload, as http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
http://mqtt.org/wiki/doku.php/topic_format
I choose not to have trailing slash, but if needed its easy to make it configurable.and get type translates from this list
char V_0[] PROGMEM = "TEMP"; //V_TEMP char V_1[] PROGMEM = "HUM"; //V_HUM char V_2[] PROGMEM = "LIGHT"; //V_LIGHT char V_3[] PROGMEM = "DIMMER"; //V_DIMMER char V_4[] PROGMEM = "PRESSURE"; //V_PRESSURE char V_5[] PROGMEM = "FORECAST"; //V_FORECAST char V_6[] PROGMEM = "RAIN"; //V_RAIN char V_7[] PROGMEM = "RAINRATE"; //V_RAINRATE char V_8[] PROGMEM = "WIND"; //V_WIND char V_9[] PROGMEM = "GUST"; //V_GUST char V_10[] PROGMEM = "DIRECTON"; //V_DIRECTON char V_11[] PROGMEM = "UV"; //V_UV char V_12[] PROGMEM = "WEIGHT"; //V_WEIGHT char V_13[] PROGMEM = "DISTANCE"; //V_DISTANCE char V_14[] PROGMEM = "IMPEDANCE"; //V_IMPEDANCE char V_15[] PROGMEM = "ARMED"; //V_ARMED char V_16[] PROGMEM = "TRIPPED"; //V_TRIPPED char V_17[] PROGMEM = "WATT"; //V_WATT char V_18[] PROGMEM = "KWH"; //V_KWH char V_19[] PROGMEM = "SCENE_ON"; //V_SCENE_ON char V_20[] PROGMEM = "SCENE_OFF"; //V_SCENE_OFF char V_21[] PROGMEM = "HEATER"; //V_HEATER char V_22[] PROGMEM = "HEATER_SW"; //V_HEATER_SW char V_23[] PROGMEM = "LIGHT_LEVEL"; //V_LIGHT_LEVEL char V_24[] PROGMEM = "VAR1"; //V_VAR1 char V_25[] PROGMEM = "VAR2"; //V_VAR2 char V_26[] PROGMEM = "VAR3"; //V_VAR3 char V_27[] PROGMEM = "VAR4"; //V_VAR4 char V_28[] PROGMEM = "VAR5"; //V_VAR5 char V_29[] PROGMEM = "UP"; //V_UP char V_30[] PROGMEM = "DOWN"; //V_DOWN char V_31[] PROGMEM = "STOP"; //V_STOP char V_32[] PROGMEM = "IR_SEND"; //V_IR_SEND char V_33[] PROGMEM = "IR_RECEIVE"; //V_IR_RECEIVE char V_34[] PROGMEM = "FLOW"; //V_FLOW char V_35[] PROGMEM = "VOLUME"; //V_VOLUME char V_36[] PROGMEM = "LOCK_STATUS"; //V_LOCK_STATUS char V_37[] PROGMEM = "DUST_LEVEL"; //V_DUST_LEVEL char V_38[] PROGMEM = "VOLTAGE"; //V_VOLTAGE char V_39[] PROGMEM = "CURRENT"; //V_CURRENT char V_40[] PROGMEM = ""; // char V_41[] PROGMEM = ""; // char V_42[] PROGMEM = ""; // char V_43[] PROGMEM = ""; // char V_44[] PROGMEM = ""; // char V_45[] PROGMEM = ""; // char V_46[] PROGMEM = ""; // char V_47[] PROGMEM = ""; // char V_48[] PROGMEM = ""; // char V_49[] PROGMEM = ""; // char V_50[] PROGMEM = ""; // char V_51[] PROGMEM = ""; // char V_52[] PROGMEM = ""; // char V_53[] PROGMEM = ""; // char V_54[] PROGMEM = ""; // char V_55[] PROGMEM = ""; // char V_56[] PROGMEM = ""; // char V_57[] PROGMEM = ""; // char V_58[] PROGMEM = ""; // char V_59[] PROGMEM = ""; // char V_60[] PROGMEM = "Started!\n"; //Custom for MQTTGateway char V_61[] PROGMEM = "SKETCH_NAME"; //Custom for MQTTGateway char V_62[] PROGMEM = "SKETCH_VERSION"; //Custom for MQTTGateway char V_63[] PROGMEM = "UNKNOWN"; //Custom for MQTTGateway char V_64[] PROGMEM = "FW_CREQ"; //Custom for MQTTGateway char V_65[] PROGMEM = "FW_CRES"; //Custom for MQTTGateway char V_66[] PROGMEM = "FW_REQ"; //Custom for MQTTGateway char V_67[] PROGMEM = "FW_RES"; //Custom for MQTTGateway
The MQTTgateway hands out ID's; configured in MQTT.h:
#define MQTT_FIRST_SENSORID 20 // If you want manually configured nodes below this value. 255 = Disable #define MQTT_LAST_SENSORID 254 // 254 is max! 255 reserved. #define MQTT_BROKER_PREFIX "MyMQTT" // First prefix in MQTT tree, keep short! #define MQTT_SEND_SUBSCRIPTION 1 // Send empty payload (request) to node upon MQTT client subscribe request. // NOTE above : Beware to check if there is any length on payload in your incommingMessage code: // Example: if (msg.type==V_LIGHT && strlen(msg.getString())>0) otherwise the code might do strange things.
-
RE: Over the air updates
@ToSa Now I remember why I changed some things in there. (broadcast to gateway)
From the beginning I had problem getting it to talk with the GW. It only sends out
<- 255,255,255,2,3,7,255, and gets no response, The GW tries to send but fails. (wierd..) (I dont have any relay nodes)This is with no modifications at all.
0;0;3;0;9;read: 255-255-255 s=255,c=3,t=7,pt=0,l=0:
0;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,st=fail:0
0;0;3;0;9;read: 255-255-255 s=255,c=3,t=7,pt=0,l=0:
0;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,st=fail:0
other packages send out works just fine.. (To other nodes)and the OTA bootloader can receive other packages
Go
<- 255,255,255,2,3,7,255,
-> 23,23,0,42,225,1,11,205,204,90,66,1,
<- 255,255,255,2,3,7,255,
<- 255,255,255,2,3,7,255,
<- 255,255,255,2,3,7,255,(from a temp / hum node)
Any ideas how to fix this?
-
RE: Over the air updates
@ToSa Yes, And I think I figured it out.. I by mistake changed BROADCAST_ADDRESS to GATEWAY_ADDRESS in the bootloader then I was playing around. Testing the correct version now..
-
RE: Over the air updates
I deleted my last message because I though I made a big mistake..
I've been working on a SD <-> OTA loader node, and got most of if working but got stuck on the last piece which is communication.. (i'll release it then I'm finished Ive made a small change in myotabootloader, add on line ~156 msg.destination = OTAGATEWAY; to configure custom ota address)
I cant figure the following out:
Just ignore contents of packages. not relevant.-
Node: (Ota<->sd loader)
read: 34-0-254 s=255,c=4,t=0,pt=6,l=4:FFFFFFFF send: 254-254-0-34 s=255,c=4,t=1,pt=8,l=4,st=ok:0100020000304200
-
GW:
0;0;3;0;9;read: 34-34-0 s=255,c=3,t=7,pt=0,l=0:
0;0;3;0;9;send: 0-0-34-34 s=255,c=3,t=8,pt=1,l=1,st=ok:0
0;0;3;0;9;read: 34-34-0 s=255,c=3,t=7,pt=0,l=0:
0;0;3;0;9;send: 0-0-34-34 s=255,c=3,t=8,pt=1,l=1,st=ok:0
0;0;3;0;9;read: 34-34-254 s=255,c=4,t=0,pt=6,l=4:FFFFFFFF
0;0;3;0;9;send: 34-0-254-254 s=255,c=4,t=0,pt=6,l=4,st=ok:FFFFFFFF
0;0;3;0;9;read: 254-254-34 s=255,c=4,t=1,pt=6,l=8:0100020000304200
0;0;3;0;9;send: 254-0-0-34 s=255,c=4,t=1,pt=6,l=8,st=fail:0100020000304200 -
OTA bootloader:
Go
<- 34,34,0,2,3,7,255,
<- 34,34,0,2,3,7,255,
-> 0,0,34,10,35,8,255,0,
<- 34,34,254,34,196,0,255,255,255,255,255,
What am I missing? package from 254 to 34 wont get delivered.
I've also noticed that then 254 tries to send, it wont receive the next transmitted message from OTAbootloader. the next thereafter is received. -
-
RE: Porting MySensors to work with the RadioHead library
@ToSa Wonder what the runtime values are...
-
RE: MQTT Broker gateway
@ToSa Thats odd. Everything looks good...(almost, there are some excess of trailing 0x00 but shouldn't matter, but I'll look at that anyways..)
Can you compile with myconfig debug enabled, but define tcpdump disabled? or is it too big that way too? -
RE: MQTT Broker gateway
@ToSa wireshark dump https://www.wireshark.org/ or tcpdump http://www.tcpdump.org/
-
RE: MQTT Broker gateway
@ToSa if possible you could make a tcpdump over the mqqt port and I'll look at it. Also a serial dump from the node would be great
-
RE: MQTT Broker gateway
@ToSa Thanks! I havn't had time to get and test that module.
-
RE: Over the air updates
@Zeph I've been working on a read / write eeprom address thing in MQTT to be able to reset a node and stuff. But it seams there are more usage for it then. This might be coded into mysensors instead. (utilizing c_internal or somthing as the protocol is today)
-
RE: MQTT Broker gateway
@Homer I'm sorry but I don't think I really understand your question.
read http://mysensors.org/build/network
Each node (with sensors) talk wireless to A gateway, which then talks to a controller (in your case Vera) this can be via RS232 OR ethernet.If you have something that talks MQTT (like openhab) as a controller, then your choice could be sensors <-> MQTTgateway <-> openhab instead.
-
RE: MQTT Broker gateway
@Homer For Vera you should build http://mysensors.org/build/ethernet_gateway
MQTTGateway is a MQTT broker (server), used for mqttclient like openhab for example.
-
RE: Over the air updates
@Zeph 16bit calculations on a 8bit mcu will always come to a price. Imo I think we should try to keep things to 8bit as much as possible. but I dont know if its possible to shred another 900bytes out of the bootloader to fit in one less size of space (1024 words instead of 2048 words). Might be if we make a mini version of mysensors/mymessage
-
RE: MySensors 1.4 Released
@hek
in http://www.mysensors.org/build/battery
I actually like mr @Yveaux vcc library https://github.com/Yveaux/arduino_vccI use it on my battery powers nodes my self (then I'm not using a stepup/down converter that is) (and I've noticed its not in mysensors lib)
-
RE: MySensors 1.4 Released
@hek Sweet! I like them
http://www.mysensors.org/radio/nrfTop.png <- I got extremely confused in the beginning because my colors on my cables did not match the ones on the image (of course) but maybe you should add PIN number to that image for extreme clarification
-
RE: MySensors 1.4 Released
@hek Great! Good work! Btw, all the images on the site - Who made those?
-
RE: Over the air updates
@Zeph true (array) and Yes, so the node can request same address twice (might be a timeout) and verify checksum on every 16byte data.
-
RE: Security
@Zeph Damn you! now I orderd 2 nRF51822 also
thanks for the heads up -
RE: Security
I've orderd these nRF24LE1 and if we are getting encryption I think it would be wise to be compatible with the embedded encryption: http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24LE1
I dont know if its a waste of money but I got 2 for 3€ a piece.
-
RE: CE line on sensor node?
@aquapro I dont think you got a nordic semiconductor nrf24l01, What I can find they are only in QFN package.
http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01So the specs on that chip may be different. Maybe CE is inverted?
-
RE: Over the air updates
@ToSa I've been working on getting OTA to work with MQTTgateway with some success.
But I do have problem with some packages missing and I think the communication should be something like this;
bootloader checks id and version and server said there is an update. (no change from today)
but then:[bootloader] 0000 has CHK FF(just filler in first package) REQ 0000 type 01 version 01
[server] load 0000 from hex, send addr 0000 0C9428030C9447240C9474240C947605 C7
[bootloader] 0000 has CHK FF, REQ 0010 type 01 version 01
[server] (checksum mismatch) send addr 0000 0C9428030C9447240C9474240C947605 C7
[bootloader] 0000 has CHK C7, REQ 0010 type 01 version 01
[server] load 0010 from hex send addr 0010 0C94A3050C94D0050C9480100C945003 00
And so on..what do you think about this? the total package is 32bytes, mysensors header is 7bytes. and this layout would need 19 bytes from server to bootloader..
I Have also seen some intel hex that is not in order 0010 0020 0030 etc but it could jump address. I do not think arduino ide does this but you never know..EDIT:
I havn't read this one yet but I guess there is alot of good stuff in it
http://www.nordicsemi.com/eng/nordic/download_resource/10878/2/94069421 -
RE: CE line on sensor node?
@aquapro Hmmmm
The chip on your looks like a blob more than this; You might have gotten a chinese ripoff .. I dont remember the chip name... Hmmmm hard to see!edit:
maybe : http://forum.mysensors.org/topic/300/rfm73-experience/ ?
inverted CE? -
RE: Over the air updates
@ToSa I've been looking through the ota bootloader and noticed there are alot of uint16_t wich can be replaced with uint8_t.. saves 128bytes of code. Still needs ~900bytes less until 1024 words bootloader though but is makes more space for other stuff
-
RE: 2.0 Discussion: Units, sensor types and protocol
@Zeph it all depends on how skilled programmer and how nerdy you are. if you want to set a lamp power with V_WATT great, thats nerdy! but in not, just dont read any thing from v_watt. .. there is no such thing as a read only variable, all depends on if you listen to incoming messages of that type or not.... I think you over-think this a bit. The atmega328 is a rather small mcu and wont be able to magically do tons of stuff. how to know what is what, well every home automation system should have a manual Write it down.
-
RE: INA219 DC Current Sensor
I have a couple of those CT too but havn't had time to learn what is needed to do a correct readout. I'll follow this and would like to follow your progress.. Mine has internal burden resistor and some protecive diods I think.
-
Watch and log free sram during runtime..
(I copied interrupt setup from another script, dont know if its 100% correct, but it works :P) i think ir runs the timer1 each 1ms.
int min_mem=32000; int free_mem=0; ISR(TIMER1_COMPA_vect) { cli(); extern int __heap_start, *__brkval; int m = (int) &m - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); if (m < min_mem) min_mem=m; free_mem=m; sei(); } int main(void) { init(); cli(); TCCR1A = 0; TCCR1B = 0; TCNT1 = 0; OCR1A = 1000; TCCR1B |= (1 << WGM12); TCCR1B |= (1 << CS11); TIMSK1 |= (1 << OCIE1A); sei(); while (1) { do_stuff(); delay(100); Serial.print("mem: "); Serial.print(free_mem,DEC); Serial.print(" - lowest: "); Serial.println(min_mem,DEC); } }
-
RE: Another way of organizing variables
@hek @Zeph
No I don't like the idea that the gateway should remember stuff about the sensors. If should be just a gateway. So it is not only about MQTT gateway but serial / ethernet gateway too. We could have a meta transportation command to transport your meta data from node via gateway to controller that handles all the magic stuff. But this will only lead to yet another byte used up in the set/req. which doesn't actually matter. for most value types 20bytes is enough for almost anything..
And why everyone is so afraid of missing one byte or 3 or 6 is weird, The discussion about the protocol is to have different commands. there some commands have more header data about the payload and other might have none (just transportation header + payload)..
And yes ofc we could add isp flash and stuff but this will make the gateway not being a gateway any longer...And the mqtt address is at the moment nodeid/sensorid/datatype. next version will have nodeid/sensorid/sensortype(text)/valuetype(text) and because I know at the controller I have the ability to use # at sensor id so I could get data via only names S_TEMP/V_VALUE ie.. and IF I am going to store anything at all is is the NODE NAME. and this will probably fill the available memory up. ofc we could go with a more expensive MCU also.. but like I already said , The gateway should be simple. It would be nice to be able to address something with MQTT/#/base_wash/#/S_Humid/V_Value. .. and maybe skip number ass together. Only to identify the mqtt address with only number, sure that would work, but it would look like a mess. if we have predefined types, just send those with the payload and we know what w are dealing with!
-
RE: 2.0 Discussion: Units, sensor types and protocol
I dont know why we have to limit some S_type to a number of V_types. Why not just let a S_type have 'all' V_types... User can be more flexible
If I wanted node could send
S_MOTION V_TRIPPED 1 (motion tripped)
S_MOTION V_ARMED 0 (no longer armed)
S_MOTION V_LEVEL 24 (motion quality 24 of 255) (probobly animal)controller decides S_MOTION V_RESET 1
(order not thought of at all, needs to be fixed)
#DEFINE S_DOOR 1 #DEFINE S_MOTION 2 #DEFINE S_SMOKE 3 #DEFINE S_BINARY 4 #DEFINE S_DIMMABLE 5 #DEFINE S_WINDOW_COVER 6 #DEFINE S_THERMOMETER 7 #DEFINE S_HUMIDITY 8 #DEFINE S_BAROMETER 9 #DEFINE S_WIND 10 #DEFINE S_RAIN 11 #DEFINE S_UV 12 #DEFINE S_WEIGHT_SCALE 13 #DEFINE S_POWER 14 #DEFINE S_HEATER 15 #DEFINE S_DISTANCE 16 #DEFINE S_LIGHT_SENSOR 17 #DEFINE S_NODE 18 #DEFINE S_LOCK 19 #DEFINE S_IR 20 #DEFINE S_WATER_METER 21 #DEFINE S_AIR_QUALITY 22 #DEFINE S_CUSTOM 23 #DEFINE S_DUST 24 #DEFINE S_PH 25 #DEFINE S_SCENE_CONTROLLER 26 #DEFINE S_NODE 255 #DEFINE V_CONFIG1 1 #DEFINE V_CONFIG2 2 #DEFINE V_CONFIG3 3 #DEFINE V_CONFIG4 4 #DEFINE V_CONFIG5 5 #DEFINE V_VAR1 6 #DEFINE V_VAR2 7 #DEFINE V_VAR3 8 #DEFINE V_VAR4 9 #DEFINE V_VAR5 10 #DEFINE V_ARMED 11 #DEFINE V_STATUS 12 #DEFINE V_WATT 13 #DEFINE V_PERCENTAGE 14 #DEFINE V_STOP 15 #DEFINE V_LEVEL 16 #DEFINE V_MAX 17 #DEFINE V_MIN 18 #DEFINE V_RESET 19 #DEFINE V_DEW_POINT 20 #DEFINE V_MODE 21 #DEFINE V_ANGLE 22 #DEFINE V_RATE 23 #DEFINE V_VOLTS 24 #DEFINE V_AMPS 25 #DEFINE V_PRESENTATION 26 #DEFINE V_BATTERY_LEVEL 27 #DEFINE V_RESET 28 #DEFINE V_TIME 29 #DEFINE V_ID 30 #DEFINE V_LOG_MESSAGE 31 #DEFINE V_SKETCH_NAME 32 #DEFINE V_SKETCH_VERSION 33 #DEFINE V_FIND_PARENT 34 #DEFINE V_CHILDREN 35 #DEFINE V_VERSION 36 #DEFINE V_INCLUSION_MODE 37 #DEFINE V_GATEWAY_READY 38 #DEFINE V_STATUS 39 #DEFINE V_IR_SEND 40 #DEFINE V_IR_RECEIVE 41
-
RE: 2.0 Discussion: Units, sensor types and protocol
@hek All these changes are more 2.0 than 1.4..
Edit;
Btw, All these extra bytes S_ and V_ to describe a payload is good for mqtt also.
And this is why we need some more command types (i.e. Stream for OTA update etc. more space for payload smaller header) -
RE: MySensors protocol format
@Yveaux
not much to say, there is room for 5 extra commands before needing to change protocol version. but I haven't put much thought in future backward compatibility.. the stream art I think OTA developer has to take a look at. I haven't had time to learn that yet. but the more space for payload the better. I have tested stream to send a small image once. but now then I think about it I don't care if the package is set or req. -
RE: MySensors protocol format
@Yveaux
http://interactive.blockdiag.com/packetdiag/?compression=deflate&src=eJx9kctOwzAQRff9ilm2labyI69aYlHRLFiURxuxRaZx24jUKbELVMC_MwkNikBi5znXYx-P3wcA66p8LXK_gwtIqLRVbh52ptjuPBERdqjbE7ABIYaxglI7D0OGIgxHxBLkoQJnbG7qHuYRCqkgN84XVvuisr1QBAoKp9dPzZq6a_N8LiKUXMGBKuOhNHZLt1NfJJs2KVBGCl5M7c7nSd7yGOVU0ZP2e23zhvP2moBhQMJDZw661r6qRzAGuLxZLGbXcwUMlukdfACHVZoBjJuOBEPyWRnrqvpq3lMOI5Lokux0ML0sCjAm63tdHs2vKBYYk9qtPpWVJrXJZEJTFBIeT964dn4Mk38kBayyZTpbfPslCU6FgvTN1xqcP242BKcSOZM_U7PHfSvAgrj9CBYg5_yvQ9g5fH4BuWqGBgI wanted to write some text but need to run!
-
RE: 2.0 Discussion: Units, sensor types and protocol
@hek S_node could include stuff as
Reboot
ClearEEprom
Read EEprom byte
Set EEprom byte
besides stream data types.
(to be discussed if any of them are useful or not and if they should be hardcoded or not) -
RE: 2.0 Discussion: Units, sensor types and protocol
@Yveaux said:
[dissing start] Did you think about sending the sensor type only once, durig presentation? There really is no need to send it with each set/req message as it is static for the duration of the connection. For Vera and the like this probably means you should buffer these values in the gateway... [dissing end]
I think for the controllers view it would be best for the node to send every message with sensor id, sensor type, value type and payload. Noone needs to remember anything The way back to the node the rest can be omitted, as long as sensor id is there.
-
RE: 2.0 Discussion: Units, sensor types and protocol
@hek I've been thinking and thinking and even might have an other solution.. but I'll wait with that.
so every piece of data has a S_type and V_type.. V_ must be a fixed unique table (not starting from 0 on every S_type)
I'm more acceptable now than 10 minutes ago..
-
RE: 2.0 Discussion: Units, sensor types and protocol
Could someone please explain to me why we have S_ types at all? I really dont get it.. I Only think it makes things more complicated. (my conclusion - I dont like it)
-
RE: Over the air updates
@ToSa Still I wonder if there is any OTA bootloader / protocol readme (So I dont have to dissect the nodejs code to write my own implementation)
-
RE: Over the air updates
@Zeph
Hmm, My approach would be at the server side decide 'Node 23 needs an update''
Send RESET node 23 (Hmm, I dont know if soft reset executes the bootloader?)
Node 23 ask server 'Do you have an update for me?'
Server : YES! and throws it away -
RE: Over the air updates
@ToSa I might have missed it but is there any documentation of the protocol used to transmit OTA?
(I looked in the source and might have missed it .. o:) ) How big is the bootloader installed? -
RE: MySensors protocol format
@Yveaux looks good, protocol version and command could be in the same byte Imo. And internal could have more uses in future. I only use reboot (which can be coded in sensor..) Battery I send as custom sensor
-
RE: 2.0 Discussion: Units, sensor types and protocol
@hek I know, ist more 'need moisture' or not Hmm... V_Moisture, (relative) 0-255 / 0-100% / True | False
-
RE: 2.0 Discussion: Units, sensor types and protocol
@hek Moisture or Water detecded... Might be 2 different ?
Thinking different applications: Moisture in ground. (I.e. Water needed? Ground dry?) And Water level, hmm, if you have a fluid level meter to detect overfill. or leakage. Fluid flow -
MQTT Broker gateway
How to Set-up MQTTGateway with OpenHAB
What is MQTTGateway:
MQTTGateway will act as a broker, a server. And any MQTT clients should be able to connect to it (Please let me know if you experience problems).
MQTTGateway is a very simple implementation. It will not care if the client subscribes to anything or not.
Every node package it receives it will publish to the client. Sketch name and version is also implemented.
Most clients handle this well and just ignores messages it hasn't been subscribed yet.
There are some settings in MQTT that can be good to take a look at.
You will need to configure TCP_IP and TCP_PORT.
MQTTGateway will also give nodes an ID between MQTT_FIRST_SENSORID and MQTT_LAST_SENSORID. The last position is stored in EEprom.As standard MQTT_SEND_SUBSCRIPTION is enabled. This basically means that the broker will send a empty payload to the node upon a subscribe package. This can be useful. Just keep in mind that you can receive empty payload packages.
The MQTTGateway will also present its SketchName and SketchVersion.
Lets get started!
First follow https://github.com/openhab/openhab/wiki/Quick-Setup-an-openHAB-Server You can setup and try with DEMO configuration first.Then we need to unpack org.openhab.binding.mqtt into addons folder * NOTE (During development of MQTTGateway I found a bug inside openhab mqtt client which is solved in 1.6.0 nightly build. Use this nightly addon if you experience problems)
-
openhab.cfg
All you need to do here is to addmqtt:mysensor.url=tcp://192.168.0.234:1883
mqtt:mysensor.clientId=MQTT
ClientID does not matter at all (just keep it short). And IP and Port is self explanatory.
Now you can start OpenHAB, it will connect but nothing more will happen.
This is because we hasn't subscribed to anything and OpenHAB will just ignore every incoming package.So here comes a sample configuration of OpenHAB.
-
items/test.items
Group all
Group node1 (all)
Group node2 (all)
Group sketch (all)Number node1_temp "Temp [%.1f °C]" (node1,all) {mqtt="<[mysensor:MyMQTT/20/10/V_TEMP:state:default]"}
Number node1_humid "Humid [%.1f %%Rh]" (node1,all) {mqtt="<[mysensor:MyMQTT/20/11/V_HUM:state:default]"}Switch node2_sw1 "sw2" (node2,all) {mqtt=">[mysensor:MyMQTT/21/1/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/21/1/V_LIGHT:command:OFF:0]"}
Switch node2_sw2 "sw2 send + recieve example" (node2,all) {mqtt=">[mysensor:MyMQTT/21/2/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/21/2/V_LIGHT:command:OFF:0],<[mysensor:MyMQTT/21/2/V_LIGHT:command:MAP(1on0off.map)]"}String sketch20 "Sketch name 20 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/20/255/V_SKETCH_NAME:state:default]"}
String sketch21 "Sketch name 21 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/21/255/V_SKETCH_NAME:state:default]"}
String sketch22 "Sketch name 22 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/22/255/V_SKETCH_NAME:state:default]"}
String sketch23 "Sketch name 23 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/23/255/V_SKETCH_NAME:state:default]"}
String sketch24 "Sketch name 24 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/24/255/V_SKETCH_NAME:state:default]"}
String sketch25 "Sketch name 25 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/25/255/V_SKETCH_NAME:state:default]"}
String sketch26 "Sketch name 26 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/26/255/V_SKETCH_NAME:state:default]"}
String sketch27 "Sketch name 27 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/27/255/V_SKETCH_NAME:state:default]"}
String sketch28 "Sketch name 28 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/28/255/V_SKETCH_NAME:state:default]"}
String sketch29 "Sketch name 29 [%s]" (sketch,all) {mqtt="<[mysensor:MyMQTT/29/255/V_SKETCH_NAME:state:default]"}
We also need to create a sitemap :
-
sitemap/test.sitemap
sitemap demo label="Menu"
Frame label="test" {
Group item=node1 label="Temp hum node"
Group item=node2 label="Switch node"
Group item=sketch label="Sketch names"
Group item=all label="Everything"
}
and a simple transformation file :
-
transform/1on0off.map
1=ON
0=OFF
If everything worked and I didn't forget anything just fire up :
http://[Openhab]:8080/openhab.app?sitemap=test
After you restart one of your node's the data and sketch name should be visible.
Openhab will forget everything after every restart. Use persistence to fix this (https://github.com/openhab/openhab/wiki/rrd4j-Persistence) -
-
RE: OpenHAB/MQTT Tips & Hints
rule to calculate absolute humidity and dew point from degree Celsius and rH%
import java.lang.Math import java.lang.Integer import java.lang.Double rule "Calculate absolute humidity (g h2o / m3 air) and dew point" when Item temp1 changed or Item hum1 changed then var temp = temp1.state as DecimalType var hum = hum1.state as DecimalType var t1 = (17.271*temp.floatValue) / (237.7+temp.floatValue) + Math::log(hum.floatValue*0.01) var dew = (237.7 * t1) / (17.271 - t1) var Number c1 = ((17.67*temp.floatValue)/(temp.floatValue+243.5)) var abs = (Math::pow(Math::E,c1.doubleValue)*6.112*2.1674*hum.floatValue) /(273.15+temp.floatValue) Dewpoint1.postUpdate(dew) AbsHum1.postUpdate(abs) end
-
RE: The best way to connect to OpenHAB
@kolaf Imo : mqttgateway (arduino + nrf24 + ethernet) (runs as a broker) and openhab mqtt client on a server
-
RE: RFM73 experience
@Yveaux found one difference so far
rfm73: Programmable frequency range 2400-2483.5MHz, 83 channels selectable
nrf24: nRF24L01 can operate on frequencies from 2.400GHz to 2.525GHz -
RE: Porting MySensors to work with the RadioHead library
@kolaf I was unable to repreduce those errors, When trying to fix it to const the compiler moved the array-table to sram instead >.< I hate progmem (and Harvard architecture)
-
RE: Porting MySensors to work with the RadioHead library
@kolaf What version of arduino IDE do you use? you should really use 1.5+
(But I'll fix so it works in older version) -
RE: PCB design and production
@ferpando I would run reset to one of your unused pins at the radio and you have a custom ISP connector.
-
RE: 1.4 Beta
@warawara did you try clearing using clear eeprom? That helped me some times. Dont really know why some nodes just wont want to recieve packages..
-
RE: Porting MySensors to work with the RadioHead library
@kolaf that sound to me as a sram overflow. There are ways to see in runtime how much free sram there is in runtime. I think there is a commented out version of it in the code..
last lines in mysensor.cppint MySensor::freeRam (void) { extern int __heap_start, *__brkval; int v; return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); }
-
RE: 1.4 Beta
I got this question from a friend and since I dont know the answer either;
I'm trying to figure out the sleep mode and if the radio module wakes up or not (via INT pin 2) .. but for me it does not seam to do this. Which sleep-modes does 1.4b have and how do I see if the message is for me, and if not continue sleep?
-
RE: INA219 DC Current Sensor
Lots of info about ac measuring at http://openenergymonitor.org/emon/
-
RE: Embed code in forum using CodeBender
It does work well in opera, codebender just dont know its supported, but I made this little video for the peeps on the irc channel
works in win7 x32 and x64 opera 23, 24 and 25. I have not tried windows 8.
http://youtu.be/p_jyIUm2GM4 -
RE: Embed code in forum using CodeBender
@gregl My quick guess without looking at it is that you have wrong .build.f_cpu=
So, the bord runs at 8mhz, but the compiler thinks its 16mhz, you enter 115200, try half (57600)..
I couldnt see your txt so include it so I can look at it, or better up, start a new thread and we'll talk about it there. -
RE: Embed code in forum using CodeBender
I'm still struggeling with my broswer (opera) trying to get in contact with them on IRC (freenode #codebender.cc (hehe I noticed a mysensors-channel there too now ^^))
Is it possible to have some custom hardware definitions? I have a modded pro mini 16mhz there I run optiboot instead of arduino bootloader (saves 1.5Kb) and yes I could use uno instead but I have changed the fuses to run at 2mhz and no burnout fuse (to be able to run on battery)
-
RE: 200pc female-female jumper cables from store - never delivered?
I had some ebay items from china being shipped by boat (3 months) ... I usally tell them to send again, but it seams like a lottery 50% if they actually will do that. So refund is a safer choice.
-
RE: Embed code in forum using CodeBender
@hek And my broswer that is chromium in the ground doesn't get recognized... Sigh
-
RE: 'MySensoring' an Intermatic EH40 (Project Completed!)
@ServiceXp Hmm, I don't really know but you might be able to use the out-pin on the arduino and a resistor, but its not really safe in case there are some leakage. I would get isolation with a optocoupler. they are really cheap to buy! Often found in broken electronics too. only to salvage!
-
RE: 1.4 Beta
@Yveaux take a look at (was thinking about your sniffer) https://github.com/mysensors/Arduino/commit/c910bfdb9e54a9a41e991734b60c757968bd8210
-
RE: 'MySensoring' an Intermatic EH40 (Project Completed!)
A relay actuator would work, I cant help so much with your question. But I want you to think some about safety also. Do not skip over safety components like over temperature and such. This could lead to a disaster. So basically 3 safety-steps:
Software at controller to regulate and send start / stop and read temperatures.
Software at relay-node to verify sane operating temperatures
and third - The absolutely most important - Hardwired safety temperature thermostat in case everything fails. (could be the relay fried stuck on i.e)write a principal scheme for better explanation!
-
RE: Inverse gateway leds behavior
@John My guess whould be to pull the led to VCC instead of GND..
-
RE: Porting MySensors to work with the RadioHead library
I think we need to think about choosing a bitter atmega for this.. Its a bit too bad that atmega havn't made a atmega628p which is pin compatible with 328 but with 64KB of program storage instead.. so the next up is 644 which arduino has no boards for. but there is sanguino.cc - https://code.google.com/p/sanguino/ though.
Next up would be Arduino Mega 2560 with what it feels like 'Unlimited ram!'
They are not That expensive today since china made its own ch340 usb - serial chip (Why this was the expensive component blows my mind :P) ATmega2560-16AU CH340G MEGA 256 you can find for ~10EUR / 13.50USD.. -
RE: 1.4 Beta
@hek another suggestion for addition
RelayWithButtonActuator
incomingMessage should check if there is any payload or not. (could be bad package)
I use empty payload as a request for latest state (Yes I could do this some other way but I think it is logical..)if (msg.type==V_LIGHT && strlen(msg.getString())!=0) {
-
RE: Mysensors MQTT gateway
@Damme Fail on me, forgot to push the update.. Now it's there.
-
RE: Mysensors MQTT gateway
And there we have it, beta 0.1
should work. Please test it!
I'll try to write better documentation as time comes. I'll answer any questions.