It has been a busy term break working with Blynk and Cayanne for Andrew’s design course. Here is the rough draft of Simon’s app which monitors and maintains the water level in a pool. Simon has an Arduino reading a eRule depth sensor, then sending the measurements over the could to an app.
The sensor is an analog sensor, sending a value of 0 to 5 volts. The Arduino converts that into a value from 0 to 1023. It measures once per second and displays on the left graph. The last ten measurements are averaged and displayed on the right graph. The terminal window displays what would normally go to the Arduino serial monitor window. The button turns LED13 on/off (just for troubleshooting). There is an LED near the top which shows whether the valve is on or off.
Built into the Arduino code is control for the servo-controlled valve. When the level goes below 300 the valve opens. When the level goes above 600, the valve closes.
Here is a video of the app in action. We used a rotary potentiometer to simulate the analog sensor. Right now the Arduino is connected via USB. We will move it to WiFi when we get the hardware. The bit at the end of the video shows how to start/stop the Blynk script which passes the USB messages on to the cloud. You need to stop this script before you upload your code, then restart it to connect.
If you want to try it yourself, here is the code (save as txt file then rename to .ino file extension):
For comparison, here is the version without Blynk:
I merged the SimpleTimerAverage with the Standard Blynk USBserial sketch from the examples in the Arduino IDE menu. The defines were merged first. Then I pasted in the repeatMe() function that the timer triggers to do the measurements once every second. Then I merged the setup loop. Then I merged the main loop. Then I put in the virtualwrites to virtual pins (V0, V1, V2 and V3) which are read by the app for the gauges, LED and terminal window.
If you want to try it with your own phone or tablet, here is the app (just open Blynk and scan the QR code):
You can put the code on your own Arduino (once you have installed the Blynk libraries) or let me know and I will plug one in on my end. You cannot make changes to the app, but I think there is a way I can share it so that you can put in your own auth code and make changes to the app. Of course, you need to sign up for Blynk before you can get your own auth codes. It is free, as long as you don’t make too many changes to the buttons or publish/share your apps.
Let me know if you have any questions.