Maketober Day 3: Use an M5StickC to display temperatures

Blockly code.png

I’m trying to use devices and things I’ve not used before. Today I’m using the Blockly environment provided by M5Stack to program their devices. This runs in the browser. You can find it here. You use the M5Burner app on your PC or Mac to program an M5 device with MicroPython plus a bunch of M5Stack libraries. You also use M5Burner to put your WiFi details into the device because (and this is wonderful) you can deploy the programs you are writing over a wireless connection.

You build a program by dragging blocks onto the workspace and fitting them together. Above you can see a program that fetches the temperature values and displays them. It took me a while to build this code what with the dragging and linking. I’m not really a fan of working like this, but then again I’m not learning to program so it’s not really aimed at me. The good news for me is that I can press the Python button at the top and be instantly transported into a world I know very well:

PythoUIFlow.png

This source is keyed to the Blockly view and if I make changes to the Python code I’ll break all my blocks, but at least it gives me a handle on what is going on. And its a great way to learn to code. When you press the run button in the top right hand corner of the page you get to run the program in the device. If you want to deploy the program so that it runs each time the device is powered on you can use the menu to download it into the file store on the M5Stick. Then you use a tiny menu on the device itself to select the program and run it.

If you are wondering why some of parts of the above images have been covered with yellow blotches this is because these are the unique ID of my Cricket device which is transmitting the temperature values. You use the device ID as both the username and the password for the connection to the Things On Edge MQTT server. I don’t think that there would be a huge problem if someone got hold of the ID of my device (although I guess they could find out the temperature in my house).

And now I’ve got a little client that lets me view the temperatures from my remote sensor. It took hardly any time to put together and it works a treat. If I have a worry about the solution it is that if anything happens to the Things On Edge company my Cricket sensor turns into a tiny paperweight - because the only way to configure the sensor is via the Things On Edge server. It would be wonderful if the whole configuration process could take place on the Cricket itself via the same web interface that it generates when you setup the WiFi connection.

Anyhoo, that’s day 3. On to day 4 when I’m going to make a little box to put the sensor in….