Long story-short, the Arduino FIO with XBee S6B Wifi radio that allows communication with the Roman Shades was slowing becoming less reliable over the last 2 years I’ve had it operating. So, I’ve replaced it with a brand new Arduino MKR1000
At first, I blamed it on the fact that the Wifi router reset. I had no code in the simple Arduino FIO sketch to attempt to reconnect if the session dropped. The Xbee is a “black box” and I have no idea what kind of reconnect logic is involved. A simple power cycle fixed the problem each time, so it’s not a big deal. However, over time the need to reset the FIO was becoming more frequent (from once a month to once a week). So, I decided to try to add some simple reconnect logic.
Things I tried:
- Soft reset using this method: asm volatile (” jmp 0″); FAIL
- SoftReset library FAIL
- Soft reset using this method: wdt_disable(); wdt_enable(WDTO_15MS); FAIL
- Hard wired a pin to the RESET pin on the board – worked at first, but over an extended time, became unresponsive. FAIL
During my efforts, I uploaded a sketch to the FIO that ultimately bricked it. I’ve re-read the sketch many times and can’t see the issue, but it shuts itself down immediately and I can’t get a new sketch to upload no matter what I try.
So, I’m thinking the Xbee S6B might have been the source of the issue, and buying a new FIO would not solve the problem. Luckily, the brilliant folks at Arduino have just released a new board called the MKR1000 – it is a similar form factor as the FIO, and has a built-in Wifi module. Currently, the only place to buy one is directly from Arduino, but the price was reasonable ($34.99 USD) and it arrived fast.
Getting the MKR1000 up and running required me to upgrade the Arduino IDE to 1.6.9 and to complete some steps to install all the necessary drivers and libraries. I ended up using several different tutorials to complete the steps. The Wifi101 library documentation is a bit lacking of good examples, but I was able to figure it out and had a new sketch based on the FIO sketch working in about 2 hours. I did have a moment of panic as it appeared that the server object did not support a static IP address, but with a bit of research, I discovered the config() function can be run before begin() to specify a static IP.
The things I like most about the MKR1000 over the FIO with XBee S6B
- I can program the board without having the remove the WiFi module
- I can program using the USB instead of an FTDI connection
- I can communicate on both the serial port and WiFi at the same time (great for debugging)
- More control over the WiFi module – I included some reconnect logic and it works great
Here is the new source code
I did encounter an unusual thing as I went to mount it on the door: When I powered it with a 5.25V power adapter (the same one I used with the FIO), it apparently over heated and stopped working after a few hours. The board was hot to the touch when I pulled it down for investigation. I replaced the power adapter with a true USB power adapter that ran at 5.1V and it’s been running fine now for the past few days. I’m a bit surprised that .15V would make such a difference, but I guess the extra voltage exceeded the tolerance of the on-board voltage regulator.
So, I’m back up and running (after about 1 week of being down) and will hopefully have a much more stable system now.