"An embedded system is a computer system — a combination of a computer processor, computer memory, and input/output peripheral devices — that has a dedicated function within a larger mechanical or electronic system... Modern embedded systems are often based on microcontrollers" ¹
Microcontrollers are made of transistors, they have memory and they are made to process information - to compute. We can then control inputs and outputs using a microcontroller. Microcontrollers vary depending on the purpose and they have different architectures. The architecture of a microcontroller refers to the way it is designed and the way it works. Microcontrollers also communicate using different protocols (agreements on how to understand them).
Barduino is the board we use at FabLab Barcelona, it is compatible with ESP32. We use 2 microcontrollers in it, the ESP32-WROOM-DA and SAMD 11. We can use the Barduino board with Arduino IDE, we just need to configure it.
The ESP32 is a microcontroller that allows Wi-fi and Bluetooth connectivity and it has lower power consumption, it has a series of functionalities including, a touch sensor, radio frequency, flash memory, and RAM memory. In the Barduino board, we use the ESP32-WROOM-DA which is compatible with ESP32. The ESP32 can't communicate directly with the computer so we also use the SAMD 11 microcontroller to serve as an intermediary.
SAMD 11 is a low-power microcontroller that has among other things, one full-speed crystal-less USB 2.0 device interface (one of the reasons why we use SAMD 11).
The Arduino board uses an Atmel AVR microcontroller. Arduino has the limited processing power and limited connectivity options (no Wi-fi and Bluetooth for example).
The Maker UNO board is specially designed for education, it has exactly the same components as Arduino (Arduino is an open-source project, which means it's legal to replicate it). It's very similar to the Arduino board but it has a few additional components that allow, for example, to use of a joystick, keyboard, or soundcard through the CH340g chip.
I learned that using the same architecture allows more integrations between microcontrollers. Microcontrollers vary in functionalities but they seem to have the same core functionalities such as power, clock, input, and output pins. Even though usually the coding language of microcontrollers is C or C++ we can use Arduino IDE and apply the functions that already exist (at least to start with) using a different board (like for example the Barduino board). Mainly the difference between the boards we checked and the microcontrollers used is how simple or complex they can be depending on their purpose. It is also important to mention that all the microcontrollers we reviewed are Harvard architecture.
→ Group Page here
The ESP32 is a microcontroller with integrated Wi-Fi and Bluetooth connectivity. It can operate with a temperature ranging from –40°C to +125°C. It also has a low power consumption. It has antenna switches, an RF balun, a power amplifier, a low-noise receiver amplifier, filters, and power management modules. It requires a minimal printed circuit board (PCB). ESP32 can perform as a standalone system or work with other microcontrollers (in Barduino we have it working with SAMD 11).
Any basic ESP32 circuit design may be broken down into 10 major sections:
Power-on sequence and system reset
Flash (compulsory) and SRAM (optional)
RF (radio frequency)
ADC (analogue to digital converter)
UART (universal asynchronous receiver-transmitter)
SDIO (secure digital input output)
At FabLab Barcelona we use the ESP32-WROOM-DA in our Barduino board. ESP32-WROOM-DA is compatible with the ESP32 (ESP32-WROOM-32) and because if it's unique antenna it has excellent wireless communication which can come quite handy for all our projects.
At FabLab Barcelona we have our own board - Barduino 3.0. It's a development board (it is like Arduino, it has the pins of the microcontrollers exposed). It has 2 microcontrollers that we can start to program almost immediately:
Setting up Barduino in Arduino IDE
Before start using the Barduino I needed to set up the Barduino board in Arduino IDE. To do that I went to preferences and add an additional board. We do have a Barduino repository in GIT, so I copy/pasted the URL of it along with the Boards Manager URLs and installed both microcontroller managers in Arduino IDE.
Note: When we have new boards we need to pre-program them because the boards don't know how to talk with the computer. With Barduino, SAMD 11 doesn't know how to talk to the USB, so we define a boot loader that sets up the initial configuration of the microcontroller so that SAMD 11 can understand what is a USB and communicate with the computer.
Setting up the serial port
In order for the computer to know how to communicate with Arduino I needed to tell it that it should be using a serial port - Generic D11C14A (SAMD11 USB port).
Making SAMD 11 blink
By using one of the Arduino's examples I could easily control a led blinking. I simply updated the code to map the pin to the correct one on my board. In SAMD 11 the led pin is the number 2.
In this code, we have 2 functions (that are simplified but usually based in C++/C). The void setup() says that whatever is inside of it runs once, in this case, we are saying that the PIN 2 is the OUTPUT, and this information stays forever (until we have a different code sent to SAMD 11), it's not checked again.
Then we have another function (functions are a set of procedures we can call with a simple line) the void loop(), as the name says it is doing a loop, so it's continuously running, a function we need to be able to see status changes through time.
Making ESP32 and SAMD 11 speak the same language
To make the ESP32 blink we needed first to upload a code to SAMD11 so that they can understand each other (serial protocol). Basically, we need booth microcontrollers to speak the same language when they read and receive data. We need to do this because SAMD 11 can talk to the USB but ESP32 can't, so SAMD 11 makes the bridge and we can use ESP32.
Making ESP32 blink
Once SAMD 11 was ready I changed the board (under tools) to the ESP32 one and made sure the serial port communication was correct and on. I then used the same example of the blink again, but this time used a faster blink (100ms) and updated the pin to the 13 - the led in the ESP32.
ESP32 programing mode
One important thing to know about the ESP 32 is that to send code the microcontroller needs to be in programming mode. We can do this by changing the switch at the bottom of the board. When it is on the left side it means it is in programming mode, so it is ready to receive the code, if we turn it to the right it is just playing the code. We also need to press the reset button so that the microcontroller realizes there is a new code inside.
I wanted to see if it was possible to blink both LEDs at the same time, so after I have the blinking working for the ESP32 I changed the board to use the SAMD 11 again, added the initial code, and send it to the board (in this example in the ESP32 and SAMD 11 blinking delay was 0,5 seconds).
ESP32 was running the previously sent code while I was adding the code to SAMD 11. Once the code was sent, both LEDs were blinking. What happens is that if I wanted to send code again to the ESP32 I needed to delete the current one in SAMD 11 and add back the code that allows ESP32 to communicate to the computer through SAMD 11.
So we can indeed have 2 codes running at the same time if the ESP32 doesn't need to be updated with new code, this might come useful as we can use the capacity of both microcontrollers.
→ Blinking Led file here
The biggest learning in the group work is that using the same architecture allows us to have a really vast range of microcontrollers to choose from depending on which functionalities we need. Also, microcontrollers can be simple or complex, that will depend on the user expertise and the purpose of the project.
In regards to the architecture of ESP32 it's important to mention that there is a big variety of ESP32 microcontrollers and it's important to check the manufacturer's recommendations when it comes to handling voltage and so on for the different pin sections and functionalities.
There were a few acronymous I didn't know what they meant so I went to check the meaning and that really helped me to understand the potential of ESP32. It seems there are a lot of functionalities that I can use in my final project, such as RF, and the touch sensor, of course, I will need also to convert analog to digital - ADC and will be using memory and so on. So I am quite excited to explore electronics further!
When it comes to setting up the Barduino board and trying out the led pins, it seemed quite straightforward forward but I got to understand better the microcontroller ESP32 after reading the documentation. I feel I need some more information about the concepts of electricity and voltage and so on, but I am sure we will learn this later on!