Enter Your Electronics & Design Project for a chance to win a Grand Prize for Originality, a Tool Set, and a $100 Shopping Cart! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
Having decided to have a go at making a web user interface for the TinyDVM I looked at a number of web pages and example programs for the Arduino MKR 1010 Wifi, being surprised to find that there were not that many. There is the official (I think it was anyway) Arduino web site containing some good information and several example programs. I started by trying the simple web server program as it displayed the values on the analogue A0 to A5 pins and it seemed like all the hard work had been done. To connect to the internet it is necessary to have a hub with (wifi) connections capable of providing an IP address. However, my first problem was that the Secrets tab didn't seem to work in the version of the Arduino IDE I was using (1.8.5). The purpose of this tab is so that your SSID and more importantly the passcode are not made public. I'm sure my version should have the secret tab active but it wouldn't work for me. I was also confused because the
#include "arduino_secrets.h"
didn't cause any errors. I assumed that was because the file existed but as it turns out the programme compiles whether the file exists or not. It didn't exist so I commented out the include statement and just inserted the SSID name and the passcode. I'll just have to be careful not to include those two lines in any screendumps or programme listings. I was then able to compile the programme but with an error about some constant not existing. After some further (frustrating) research on the internet it turns out that I didn't have an Arduino MKR 1010 Wifi but an Arduino MKR 1000 Wifi. Who knew! I didn't even realise that the MKR 1000 and MKR 1010 were different as I just assumed that the designation MKR 1000 was a generic identifier for all the MKR boards. Once I worked this out I then had to install the WiFi101 library as the MKR 1000 and MKR 1010 use different WiFi modules. Happily the same or similar Web Server example programme also existed for the MKR 1000 WiFi board and low and behold it compiled and uploaded without any further problems.
It has been some time since I did anything with the web, HTML, clients and servers so I'm not entirely sure what is going on, but the TinyDVM seems to make a connection with my local WiFi router/hub and is allocated an IP address, as illustrated in the Arduino IDE serial monitor window screendump below:
Then to get the TinyDVM showing voltages on a web page via the internet, you just need to put the allocated IP address into the URL bar of the browser being used and the very simple web page incorporated into the Arduino programme displays the voltage, as illustrated below:
This is set to update every six seconds so it is not particularly useful for using as a test instrument for something you are physically working on, but if it was remotely located then it would be possible to view the voltages. Below is the part of the program that implements the web page, which as you can see, is very simple HTML:
It is not exactly the Internet of Things (IoT) because it is only accessed via my local router and is therefore not on the cloud so no-one else can access it, but all I need is a cloud client account and a better web page and probably a lot more understanding and knowledge than I currently have. Still, the general gist of what is needed has been implemented and is working. With a bit more time I could refresh my HTML skills and I might be able to make the web page better, but I think the time has run out for this project challenge.
It has been great fun doing this project and I have achieved my main aims of getting more familiar with my 3D printer and starting to get to know the Arduino MKR 1000 WiFi.
Top Comments