This week we learned about embedded systems which are specialized computing systems designed to perform specific functions within larger mechanical or electrical systems.
In other words, they are designed for a particular task or set of tasks, and have a limited processing power, memory, and storage.
To run this task we need a microcontroller which is a compact integrated circuit that includes a CPU, memory (both RAM and ROM), and peripherals (like timers, I/O ports, and communication interfaces) all in one chip.
Data sheet comparative
Understanding and comparing the microcontroller datasheets is important because it will help us to select one that adjusts to our project requirements (like GPIO Pins, Operating Voltage, and compatibility).
For this exercise I compared the ESP32 and the Raspberry Pi Pico (RP2040) both good microcontrollers for my project
ESP32 series
The ESP32 is a chip that combines Wi-Fi and Bluetooth in one device. It uses low-power technology to work efficiently and reliably. The ESP32 is part of the ESP family of microcontrollers, making it suitable for many different applications.
This series encompasses a variety of model variants, each denoted by a unique set of characters after "ESP32-", such as D, O, WD, R2, H, Q6, and V3.
Regardless of the specific model, all ESP32 devices share common core capabilities
The series is designed to work with chip revisions v3.0 and newer, ensuring the latest advancements and improvements.
The models that have the abbreviation "NRD" are no longer recommended for new product designs, for different reasons like newer versions.
The ESP32 chip comes in different physical sizes, called packages. The most common ones are 5×5 mm and 6×6 mm.
The chip packages do not change the pin numbers or functions on a development board.
The image shows the pinout diagram of an ESP32, on the table we can see the general description of the pin.
Pins used for flashing firmware and booting the ESP32
Vectorizing an image in Adobe Illustrator
1. Open Illustrator and select open file.
2. Open the image you want to vectorize.
3. Search the object section in the tool section and select image trace and click make (do not expand yet).
3.1 You can also use the right panel control and select image trace. Either way is fine.
Note: If your image is to big, Adobe recomends you to rasterize it.
If you do not rasterize it the image tracing will take more time, but have higher fidelity.
3.2 To rasterize, go to object in the tool section and select rasterize.
3.3 Change the parameters to your necesities
4. Move the image trace parameters to your necesities, I chose the color mode and moved the advanced features to my liking. Then clicked expand.
If you rasterized, the results will change a little (have less fidelity to the original image, in this case it colored the ear outline with yellow, but can be fixed)
Feature
ESP32
RP2040
CPU
3.3V power supply
3.3V power supply
Power
3.3V power supply
3.3V power supply
SRAM
3.3V power supply
3.3V power supply
Flash Memory
Enable pin to power on/off the ESP32
No EN pin
Clock speed
3.3V power supply
3.3V power supply
GPIO Pins
5V input voltage
5V input voltage
Analog Inputs
GPIO0 - GPIO39
GPIO0 - GPIO29
Communication
ADC1_0 - ADC1_7, ADC2_0 - ADC2_9
ADC0 - ADC1_3
Languages
GPIO for PWM
All GPIOs support PWM
Wireless
DAC1, DAC2
No DAC pins
First exercise (button and led)
Before doing an exercisie related to my project (pill dispenser), I wanted to do a small warm up on wokwi using an ESP32 to turn on a led with a button and screen printing if the led is on or off.
I also compared the same exercise but with different languages (MicroPython and C++)
Wokwi Project Link
7.1. Change the fillet parameters.
8. Change the part's colors.
Modeling in Inventor
7.1. Change the fillet parameters.
8. Change the part's colors.
Both softwares are pretty good options and choosing one depends on your design. Onshape is a cloud-based and accessible alternative, that is efficient for modeling and collaboration. However, rendering options are limited (can change color but not add textures).
While Inventor allows rendering directly inside the software, with ambience lights, materials. But can take a while to rendireze depending of your computer and the quality of the image.
Pill dispenser exercise
Media compression is important while documenting our process. Some media files (images, video, audio) are often large and by compressing it we are not only reducing its size but speeding up the page load times.
For Images I use Xconvert on my phone and, because it allows me to control the compressing parameters and file format, if the images are on my computer I either use the Photos app or share them via phone link to compress them in Xconvert and share them back to my computer.
For videos I use FFMPEG, that works on our computer terminal and has different parameters that we can edit if we write them. Its interface can be confusing but its really practical.
Compressing images with XnConvert
3. Select the images you want to compress. However XnConvert can only do batches of 10, if you select more, the app will only process 10.
4. Change the parameters to your needs, you can change the file type, the quality and the size percentage.
5.Click on convert and you will have the result files, its size appears at the bottom corner.
7. Click on the share icon. I have my cellphone and computer syncronized, so I select my computer.
8. The file's share interface will appear, click on the circle of the device.
8.2 After clicking the center circle it will load the images.
8.3 After sending all the images to my computer, it will actualize its status to "Shared"
On my computer appears a notification that my files were sended.
Compressing images with Photos (computer)
1. Select the image you want to compress, right click to select open with "Photos"
2. Right click and select resize image.
3. Move the parameters to your liking. You can select PNG, TIF, BMP or JPG as file type. I selected JPG and controled the parameters until the "new" size was small enough.
4. Save and rename your file.
Compressing Videos with FFMPEG
1. Download FFmpeg from the official site. And select the package compatible with your device.
2. Select the zip file and expand it.
3. Write "env" in the Windows search bar and select "Edit the system environment variables".
4. Create a new variable and copy the path to the extracted FFMPEG bin folder.
5. Open the Terminal, and Run the following command:
ffmpeg -i "name or path of your file".mp4 -vf "scale=-2:720" -c:v libx264 -preset slow -crf 30 -pix_fmt yuv420p -movflags +faststart -an "name of your compressed file".mp4>
6. Enter the command and it will process it.
The original video had a size of 6.26MB.
While the compressed video new size is of 200 KB aprox.
For large batches I prefer XnConvert, even if I need to share them back and forward between my computer (Phone Link is pretty fast and XnConvert has more resize parameters). However for single files on my computer that I need fast, I use the Photos app.