Help please ! total noob here !!
-
hi, I just bought everything I need to build a mqtt Gateway and a door sensor (i think it's the simplest one ! )
So I need my sensor to tell my mqtt gateway when the door is open. then he will tell my mqtt broker (my mac mini and i test it it work ) and from there openhab take the info.
Here my issue : I follow a lot of tutorial on the web but no one did it the same way and with the same code So i can not take the info from one and from another ...
So i need a schema for my mqtt gateway (who is arduino uno r3, NRF24L01 Radio and W5100 Ethernet module )
I need the code for it ( I look here but i didn't understand why i have a .h and a .ino https://www.mysensors.org/build/mqtt_gateway )
and also a code for my arduino mini pro 3.3v (don't need the schema is pretty easy ) can i use this one ?
https://www.mysensors.org/build/binaryI read about noob tutorial but it doesn't help much with my sensors library
I look here but the guy don't show is shema so i'm a bit lost http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/2
finaly how did i make my 2 arduino talk to each other with the NRF24L01 ?
Ok so thanks for all the answer you gonna give me even it's a little bit and i know i'm asking a lot a the same time but I REALY want to do my own sensor and understand well the arduino.
p.s sorry for my bad english ...
-
So i need a schema for my mqtt gateway (who is arduino uno r3, NRF24L01 Radio and W5100 Ethernet module )
Wiring for W5100 is available at https://www.mysensors.org/build/ethernet_gateway
Wiring for nrf24l01+ is available at https://www.mysensors.org/build/connect_radioI need the code for it ( I look here but i didn't understand why i have a .h and a .ino https://www.mysensors.org/build/mqtt_gateway )
To understand why a .h file is used, you'll probably need to learn quite a lot about c programming. A short introduction to h files is available at http://www.learncpp.com/cpp-tutorial/19-header-files/
However, it should be possible to use the examples without understanding every detail.and also a code for my arduino mini pro 3.3v (don't need the schema is pretty easy ) can i use this one ?
https://www.mysensors.org/build/binaryYes
finaly how did i make my 2 arduino talk to each other with the NRF24L01 ?
That's what MySensors is for. If you follow the examples, they will start talking.
-
I tried openhab and MQTT via an ethernet gateway when I first got started, and quickly got lost with all the bindings and suchlike. I switched to domoticz via serial gateway, which kind of 'just works' and haven't looked back. Keep at it, you will get there.
-
@Matt Thank you for your answer but my openhab setup is already configure... Yes it was a pain at first but right now I understand the system and everything works fine so i try to stick to it
-
Thank you for your help but i still have a major question !
So i follow this guide : https://www.mysensors.org/build/ethernet_gateway
even for the wiring because of the sofspi
and upload this code : https://www.mysensors.org/build/mqtt_gateway
I set up the ip address for it but i can't understand how he gonna talk to my mqtt server there no place in the code to add my mqtt server.
p.s my mac didn't see my arduino mini pro i'm gonna bring it to my office and try it there but is there something i can do ?
Than you
-
The mqtt gateway sketch in the build section of the mysensors site will create an mqtt broker. If you want the gateway to act as an mqtt client you have to use the dev branch, ie not any 1.5 releases, mysensors library and mqtt gateway sketch at github.
The pinned guide in the forum about mqtt client gateway is for the dev branch library. If you read the first post carefully you should be able to set that up. But first you need to have a copy of the dev branch mysensors library in your Arduino IDE, so that you can build the mqtt client sketch.
-
OK thank you ! and if i use another code can i use the same wiring ?
-
Yeah, the wiring should be the same for both release and dev branch, to my knowledge.
-
Hum ... when i use this code : https://www.mysensors.org/build/mqtt_gateway
I can ping my arduino
But when i use the one you told me to : https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/GatewayW5100MQTTClient/GatewayW5100MQTTClient.ino
I can't ping it .. what happen ? is it because it's not the same wiring ?
-
Are you sure you have the correct address? Have you changed the sketch and defined the ip address of the arduino or commented those lines? If you comment them, you should use the address that your router or similar assigns to the arduino.
/ Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,178,87 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,178,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0
-
Ok that is weird ! I try with and without static adress and it both didn't work BUT the first time I try without static IP it worked ! the ping worked ! so i try to unplug the arduino to see if it was the right device and yes the ping stop so I plug it back and since then ... nothing ...
I was wondering, I replace all the mysensor library with de developer branch is that ok ?
-
Yes, you should replace the whole library when changing between versions. Personally I use git for this, but you can also just delete the old library and copy/paste the new library.
-
ok so what is wrong then ?
-
How do you know the ip address of the arduino when not setting a static ip in the sketch or in the config? Have you mapped a static ip to the mac address of the arduino in your router?
If you're 100% sure you're pinging the correct address each time, and you successfully pinged the arduino after one boot but not after a restart with the same sketch, I would suspect hardware problems. Could be a power issue.
-
Hi, first of all, thank you very much for helping me like that !
I'm a Noob with my sensor but i'm a network guy (it's my job !) I know how to find an ip address !
I know pretty much all my device on my network so i just look on my dhcp server to see if new device show up . Also i use a software to scan every device on the network
I don't map the mac adress because i didn't have the time. Like I said it work only one time.
I was afraid that was a physical problems so I retry with the first sketch
( https://www.mysensors.org/build/mqtt_gateway )And it work ! I ping it without any problem...
EDIT : I just saw this in my code :
//W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4
Do I need to uncomment the second line ?
-
It look like the issue come from the dev branch :
https://forum.mysensors.org/topic/1728/uno-ethernet-shield-radio-init-fail-solved/2
Is there something i can do ?