Introduction
The Internet of Things
The Internet of Things or IoT for short is one of the major subjects in computer science these days. Micro-controllers with Internet access can be bought for a few Dollars and these devices are powerful enough to even run a (Micro) Python interpreter locally. In addition, they have all the interfaces needed to access many types of sensors needed for IoT work. These include GPIO, I2C, I2S, SPI etc.
In this course we will learn how to write Python code for the ESP32, a powerful dual-core 32 bit micro-controller, which can be purchased for ~ 4-6 US $. Many sensor "shields" are available which can be simply plugged into a "base board" together with the CPU board, where the base board provides all the necessary connections. Like this no soldering, breadboard cabling work etc. is necessary.
The goal of the course
The course teaches some basic Python programming and the acquisition and control of sensors and actuators implemented on the sensor shields. Display of the acquired data can be accomplished natively with TFT display boards or remotely through a WEB server or MQTT data transfer to a server on the Internet.
Almost all the exercises that made up the course on embedded systems on the Raspberry Pi in C can also be accomplished with the ESP32 in (Micro) Python. In the new course all software is developed on a PC and uploaded to the ESP32. The necessary tools will be explained.
If your knowledge of Python is not up to date or you have to learn the language from scratch
https://docs.python.org/3/tutorial/index.html is a good place to start.
Many of the software drivers for sensor readout are already embedded in the Python interpreter but students can also write their own drivers and add them to the system. For the "high flyers" it is also possible to write drivers in C, e.g. when speed is of utmost importance, and to integrate them into the Python interpreter. This however requires some knowledge of the inner workings of MicroPython.
While the course on embedded systems exclusively looked into device readout and control, the Internet access and more specific WiFi access, will be part of this course.
Raspberry Pi versus WeMos D1 Mini ESP32
The previous course was based on the Raspberry Pi, probably one of the most powerful micro-controller systems available today. It uses a Broadcom BCM2837 64 bit quad-core ARM CPU and it runs a full Linux operating system. You only need to add a micro-SD card for the OS, a keyboard and mouse and a screen to make it a full-blown computer. It has 1 GBytes of RAM, 32 GBytes of SD card for the systems we used and a 40 pin extended GPIO connector to interface to external devices. I2c and SPI interfaces are available on this connector. It still does not have the power of a standard PC but it can be used to develop programs, in whatever computer language available in Linux, natively on the machine. The typical cost of such a system is in the order of 70-100 US $ excluding the screen, keyboard and mouse. Of course, it would have been possible to use the Raspberry Pi also for the IoT course with Python we are talking about now.
The ESP32 contains dual-core Xtensa 32 bit processor, 520 kB of SRAM and typically 4 MBytes of flash. It does not run a full operating system and development is typically done using a cross-compiler an a PC. It has a WiFi network interface, Bluetooth
BLE, 2 8-bit DACs a 12 bit SAR ADC with up to 18 channels, SPI, I2C, I2S and 3
UARTs. These resources are to run a (Micro) Python interpreter, which is compiled on the PC and uploaded into the ESP32 flash. A simple file system is provided with the interpreter. Once the interpreter is installed on the device it can be accessed through one of its serial lines.
--
TWiki Admin User - 2020-04-25
Comments