4. Embedded programming

This week topic was Embedded programming and familiarize yourself with microcontrollers. This far this is most familiar topic for me. I have hardly ever used arduino or ESP32 boards myself but guided students with theyr projects on several occasion. Freescale i.MX family was most familiar to me when I was still working as a programmer. Altought last coding experience is from 10 years ago, last four years I have helped jobseekers with programming studies among other fields of ICT. With this I don't need to worry withs programming language I'm using, even thought now days I mostly have to read Python.

Group work

Our team group work can be found here. We compared three different development boards from Seeed Studio XIAO line. We measured frequency that processor can communicate with GPIO pins. With this test RP2040 performed the best, but this only one thing to consider when selecting board for your needs. All the boards have different sets of attributes ie. more cores(RP2040), connectivity(ESP32) or power draw(SAMD21).

Datasheet

During local class we went throuht the datasheets of provided microcontrollers. Datasheet includes wast amount of information and can seem daunting at first but when you start to know what you are looking for it gets easier.

Arduino IDE

During local class we installed Arduino IDE as programming interface. This is very simple process and you can do it without admin rights for your own windows account.

Arduino.cc.

Arduino IDE it very straight forward to use after you have your board conficured for use. Code and compilation and upload buttons are main things you need for basic usage.

Arduino IDE.

RP2040 board package

Board package installation is not hardship either by just following manufacturer documentation that you can find from here

RP2040 board package.

You can install all nessessary packages at the same time.

Board packages.

Installing RP2040 and SAMD boards

Installing board.

Installing ESP32 board

Installing ESP32 board.

Depending at intended usage you my need to install one or several libraries to use different pheriprerals. At local class I only installed library for NeoPixel led thats included Seeed XIAO RP2040 board. Later I added library for DHT11 sensor.

Library manager.

Adding NeoPixel library

Adding NeoPixel library.

Selecting correct board

Selecting correct board.

Selecting port

Selecting port.

Installing DHT11 library

Installing DHT11 library.

Remember to change port

Remember to change port.

DHT11 sensor circuit schematic from https://how2electronics.com/getting-started-with-seeed-xiao-rp2040-with-projects/

DHT11 sensor schematic.

DHT11 circuit

DHT11 circuit.

After uploading code to board at first try I got failed to read from sensor error message, first thing to try was reinstall library for DHT11 as this didn't work I turned to sensor itself.

Failed to read from sensor.

My DHT11 sensor, closer inspection showed pin labels - and s withs I interrepted as signal and tryied to correct my circuit.

My DHT11 sensor.

Corrected schematic form my sensor

Corrected schematic form my sensor.

After changing my circuit I was able to read values from sensor.

Sensor readout.

Treasure chest from the past. Over the years hording electrical component have left pile of wonders to go thru.

Treasure chest.

Tested potentiometer control circuit

Tested potentiometer control circuit.

One other thing I really wanted to test was use ESP32 as a web server. In general ESP32 included connectivity offers very interesting possibilies for the developer. For the installation process I just folloved steps an a link our local instructor provited.

ESP32 port selection

ESP32 port selection.

ESP32 web server running

ESP32 web server running.

Client connected from phone browser

Client connected from phone browser.

Control from the phone

Control from the phone.

Web interface

Web interface.

Hosting about page from ESP32

As a test I modified the code to host my FabAcademy about page. I stripped the page to bare html code so no css format used in the test. For the picture I only tested link to external site and using Base64 coding. One thing to test in the futere will be storing images locally.

Hosting about page from ESP32.

Example of modified code for hosting about page

Modified code for hosting about page.