As I have been on furlough this is a learning exercise as to how to control a device via a web page.#
Voice control is a common requirement for many – and many commercial devices are now available via Alexa or other such service – and these work well on web pages – can they be used somehow?
Any kind of microprocessor or embedded controller needs some kind of user input, such as “up” “down” or “on” off” for certain functions, a web site, when hosted by the device, would be accessible on any web browser on any device. A web page also allows for data reporting (position of an encoder, temperature or other sensor output) and data entry (position to move to, set point for a heater and so on).
This project shows how it is possible to operate a device via a web page on a web browser, in this case 2 LED’s. We also demonstrate that it is possible to use the web page by voice – which then makes the embedded device voice controlled. This is free and open for anyone to try, please contact me if you have a project in mind and need some advice.
I have investigated how to host a webserver on an embedded device in order to operate devices connected to it.
Any web enabled computer (Android, Windows, Apple etc) would be able to access the site and operate the devices so connected.
As a bonus many web sites offer assistive access, including voice control, and I wished to see if I could access and then operate devices by voice alone. The micro computer tested is shown in the picture with the yellow network connection. A wireless connection would work the same way.
Many programmable devices from platforms such as Arduino or MBED, have network connection options (via wired or wireless) and can be coded to host a webserver. Many devices come with template programs for this.
Once you are connected it is possible to post a page to any web browser. The page is coded in HTML, a script based language, which is possible to save and manage using micro code. The HTML script,once sent to the browser, sets up buttons for the user. An example web site is shown in the main image and the script that makes the web page is shown below. The web page itself will open on any web browser on a phone or other device. Buttons can be made larger and so on, and other controls can be added, such as sliders, data output and data entry. These might show sensor information, or allow the user to enter set points, such a position, speed, temperature and so on.
In addition, if you install the extension “Handsfree for web” in Google Chrome (https://www.handsfreeforweb.com/en/), you have the ability to operate the buttons by voice. The extension has a very good help page which tells you all about it. When you say “Click Button” the possible click options are numbered. Then say the number and that clicks the button. The embedded device collects the message which goes back to it and operates whatever function is coded.
<h1>To toggle an LED, start Handsfree for Web and then Say ‘Click Button’</h1><p>
<form name =”aform1” method = GET form action = Buttons_1><p><input type =”submit” role=”button” value =”LED 1“>
<form name=”aform2” method= GET form action = Buttons_2><p><input type=”submit” value=”LED 2” role=”button“>
Any person with suitable coding skills will be able to make their embedded device voice operated without additional software coding or cost, if they choose to offer a web interface.
It does not require significant processor power as the voice processing is done by the web servers of course, and you also have a control interface that will work on any computer or phone without installing software on those devices.
Please feel free to contact me if you wish more details. My example is running on an M4 processor coded using MCUXpresso, a professional platform, however, this could easily be made to work for Arduino or MBED and so on.