@yveaux do you know what development ide i have to use to compile the bootloader? i cant find anything with google on this. I allready found where to change the RF channel in the source but i have no idea how to compile it into a hex file. Tried vs code but i probably have to install another extention
Best posts made by jimmy loyens
RE: Arduino pro mini dead after flashing MYSbootloader.
Batt/temp/hum/light/6*dig pcb for grabs
Can i interrest anyone in a pcb design + code for a battery powered (2*AA) sensornode for arduino pro mini 3v3? Can measure temperature/humidity by DHT22, light intensety by TSL2561 with jumpered interupt trace and 6 digital inputs (with interrupt configurable pull-up/down). Allso has voltagedevider for battery measurement. You can pin on any onewire sensor (3v3) instead of DHT22 (with same pinout) or any I2C sensor (5v) instead of TSL2561 (with same pinout), but code is written for these sensors. You're welcome to rewrite the code or write your own (just share a copy with me). Nodes are running in my home for >1 year now and work great. I'm writing this on my phone so don't have the files at hand, but if anyone is interested just reply to this post and i will post the files. Sharing is power!
Today i allso ordered the prototype pcb's for dual motion sensor/repeater with 230VAC onboard powersupply. If it checkes out i will be sharing this to.
RE: Cant set static node ID above 254
@mfalkvidd hi, i'm building a home automation system with mysensors, openhab, milight, .... . Like most people who use mysensors i guess. Most of my node id's aren't populated yet. But when i started out i devised a table with node id ranges. One range for every room. To be shure i went ahaid and reserved 20 id's per range. Just so i wouldn't run out of id's in the future, since this looks to be a never ending project. I reserved the higher ranges for zones outside and since up untill now i had no sensors outside i didn't notice my ranges where to high. Now i rewrote my range table so i have 17 id's per zone (should be more then enough) and rooms like toilet only 4 id's (right, like i was going to put 20 sensors in my toilet ). So everything should be fine. I spend today recoding openhab and flashing nodes. Everything is running like it should again and even found some typos.
RE: Arduino pro mini dead after flashing MYSbootloader.
Only for MYSbootloader
First off know that the bootloader needs to be compiled for the right clock-mode (internal osc/RC-osc/Xtal) and for the RF channel the node is going to be used in. You can build your own bootloader from the source at https://github.com/mysensors/MySensorsBootloaderRF24 or use a precompiled bootloader from https://github.com/guillebot/MYSensors-Bootloaders with thanks to @Guillermo-Schimmel .
Next make sure you have the right driver for the USBASP installed. Like the video on https://www.mysensors.org/about/fota suggests use Zadig (https://zadig.akeo.ie/) for this. The driver may be dependent on your operating system (I'm using Win10 and libusbK (v126.96.36.199) works for me). If u use the wrong driver it may be possible to read and write the fuses but burning the bootloader will fail!
Make sure you are using the right fuses for your board. If not you may even potentially brick your board (i.e. if you dont have a Xtal on your board and use the internal oscillator but do burn the fuses to use a Xtal you will have to solder a Xtal to your board to reflash the right fuses because otherwise the µC wont have a clocksource)[not sure if this is 100% correct] If you don't know how to set the fuses correctly for your board use a fuse calculator like this http://www.engbedded.com/fusecalc/. If you dont know the meaning of some of the fuses you can look them up in the datasheet of ATmega328P.
Now you can open AVRDUDESS to first check the connection of yourUSBASP and then burn the fuses. First connect your board to USBASP and click on detect. AVRDUDESS should indicate the MCU is a ATmega328p (even if its a arduino clone). You can either burn your fuses seperately by filling them in in the "fuses and lockbits" frame and clicking write (leave the lockbits alone or you might brick your MCU) or burn them together with your bootloader (if you use AVRDUDESS for bootloader) by filling in the bits and ticking the set fuses box. When burning the bootloader the fuses will be burnt first.
For burning the bootloader you have 2 options. You can either burn the bootloader using the arduinoIDE like explained in the video but i prefer using AVRDUDESS (less hassle with editing the boards.txt file and adding the bootloaders to the right arduino directory). To burn the bootloader with AVRDUDESS just drag and drop the right bootloader into the "flash" textbox of AVRDUDESS, make shure the radio button for write is active and hit go. Tadaa!!! the bootloader is burnt.
Now you can program your board (the good oldfashioned way) with a MySensors sketch using the same RF-channel as the bootloader. Make shure your gateway is allso programmed with the same RF-channel as the first thing the node (bootloader) does after booting is connecting to the gateway. This means your gateway needs to be online before the node can execute its sketch [pretty shure about this but not completely It will take the MYSbootloader a little longer to run then the stock bootloader so don't panic when you don't see anything in serial monitor at first, it should be coming.
==> With mys bootloader burnt its no longer possible to program node in "the old fashioned way" (using arduino IDE and serial connection). All updates must be made OTA!
When you get output in serial monitor its time to install MYController (not the same as MYSController!). You can start the service by running "mycontroller/bin/start.bat" on windows or entering "./start.sh" on linux. Here is a (outdated) doc on MYController https://www.mycontroller.org/#/documents/user/1.4.0.Final.html. Now open a browser and go to deviceIP:8443 and log in to MYController with username:admin, password:admin. Under resources=>gateway enter the gateway setup you use for MySensors, and be shure to select MySensors under network type. Now you can enable your gateway in the table, select it and go to actions in the top right. There select discover. Now your nodes should be discovered automaticly. You can check this by looking under resources=>nodes. If not you can look under status=>resource logs to debug what's going on.
To be able to do FOTA updates you need a .hex file of your sketch. You can do this by adding "build.path=C:\Arduino-Output" to the bottem of your arduino "preferences.txt" file (see https://www.mysensors.org/about/fota)[but this file seems to be deleted every time arduino starts!], load the desired sketch in the arduinoIDE, make shure the right board is connected and click verify. Now the .hex file should be in your C:\Arduino-Output\ folder.
Now the part we've all been waiting for, the FOTA update! Under utilities=>firmware on the top right select "types" and add a type of node, then select version and add a version. After this you can select firmware and choose a hex file you compiled earlier. Go back to resources=>nodes, select your node you want to update, click actions=>edit. Here you can appoint a firmware, type and version to your node. hit save! Back in the nodes window select the same node go to actions=>upload firmware. Your first FOTA update should be underway.
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
I just found this post on the forum: https://forum.mysensors.org/topic/6352/pin-change-interrupt-on-any-pin/11
It adds "_wokeUpByInterrupt = 0xFE; // Dirty hack to get out of MySensors sleep loop" at the end of every ISR
"// Unset value from dirty hack to get out of sleep loop (set in interrupt)
_wokeUpByInterrupt = INVALID_INTERRUPT_NUM;" at the beginning of loop.
I tried it, not knowing at all what i'm doing by adding these lines. But i do know it works!!! Even if it is a dirty hack, IT WORKS!!!!
Now i can rewrite my code to do the processing/messaging in loop outside of the ISR. If anyone can explane what these lines do exactly please let me know.
It would be even nicer if somewhere in the future there could be a sleep function in the MySensors library that supports these pinchange interrupt vectors, but this hack makes it work for now.
Thanks for all the help!