Few days ago I wrote about SCADA for Arduino that allowed to build a nice computer user interface for controlling Arduino. This post is a continuation to that.
In the earlier posting I got the LED on Arduino board to be controlled on/foo with SCADA software. Now I connected a relay module to this output to be able to control something real, not just the LED on the board.
I looked at the Arduino source code and found that modbus register 0 controls the LED (pin13 in Arduino board). Writing 1 turns LED on and writing 0 turns it off, which was expected. The Arduino source code revealed also that if you write any other value (for example 2) to this register 0, the LED goes to flashing mode.
To test the flashing I had to change the SCADA project. It was pretty easy to add a new button for LED flashing: I just made a copy of the “on” button and modified the button properties (the value it writes to the register from 1 to 2 and text to “flash”). That was easy. After pressing “flash” the led seemed to be dimmer than normal and relay started “singing”. Maybe the flash rate is a little bit too high.
The Arduino source code revealed that the flash rate is controlled with value stored to register 1 in milliseconds. The default value on that register must be a too low. When I write 1000 to this register the LED started flashing as I expected. Finally I added two buttons to SCADA project: slow and fast flashing. I needed to look at the SCADA software manual how to add a new SCADA variable that maps to register 1 on the Arduino. After creating the variable, changing the button properties to new variable and values was easy task.
Things started to work after some learning. It seems that the SCADA software that comes with SCADA for Arduino project is quite easy to use when you learn the basics, but some things in there could be more intuitive.
I also found out the the SCADA editor could be more stable: I crashed it several times while doing the project editing. In the editor there are several places where you need to press exactly the right buttons to get out of them properly, pressing other that right button to close then crashes the SCADA editor. I had to learn by doing what to do and what to not to do. And I learned from that that it’s a good idea to save very often.