-
Notifications
You must be signed in to change notification settings - Fork 3
Home
In 2017 we gave a course on Embedded Systems at the Department of Computer Science and Information Technology at the University of Cape Coast, Ghana. The course was based on the Raspberry Pi with C chosen as programming language. Already immediately after the course the idea came up to change the programming language to Python considered by many to be easier to learn. For the new course we also changed the underlying hardware to WeMos D1 mini cards using an Espressif ESP32 as a processor. The main reason for this change was cost. The total hardware cost should stay at ~ 30 US$ to make it affordable to students also in developing countries.
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 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, bread board cabling work etc. is necessary.
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.
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.
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.
Course on the Internet of Things at the University of Cape Coast, Ghana