9. Embedded programming¶
▶ Group assignment ✌¶
- Compare the performance and development workflows for other architectures
For this week’s group assignment I need to compare the performance and development workflows for different microcontroller families here I compare my PCB with the different program language
AVR (ATmega328P)¶
The ATmega328 is a single-chip microcontroller created by Atmel in the megaAVR family (later became Microchip Technology acquired Atmel). It is based on a modified Harvard architecture 8-bit RISC processor core.
Specs¶
I go through the ATmega328P Datasheet its around 249 page (Too much) I boil down the most important Specs, the ones we need to know in common projects
Header One | Header Two |
---|---|
Manufacture | Atmel corporation |
Architecture | Harvard |
Operating Voltage | 1.8 to 5.5 |
Flash Memory | Item Two |
Digital I/O pins | 32 |
Max Speed | 16MHz |
source:
Microcontroller board
Microcontroller pinout
Programming Environment
Arduino IDE
The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc. for me and I think many people agree with me The Arduino UNO is the best board to get start with electronics and coding.
code
I test it by upload a simple code An LED-blinking and I program on all two development boards as following (Arduino and ESP32):
// the setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin 0 as an output.
pinMode(10, OUTPUT);
}
// the loop function runs over and over again forever
void loop()
{
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
video
ESP8266¶
The ESP32 Dev is a small development board produced by Espressif. the I/O pins are broken out to the pin headers on both sides for easy interfacing. you can either connect the pins with jumper wires or mount them on a breadboard.
ESP it’s the best solution for simple prototyping or home automation tasks, and it’s not expensive you can find many free tutorials and exercises
Specs¶
Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
Header One | Header Two |
---|---|
Manufacture | Espressif Systems |
Architecture | Harvard |
Operating Voltage | 3.3V |
Flash Memory | 4MB |
Digital I/O pins | 16 |
Max Speed | 80 MHz |
source:
Microcontroller board
Microcontroller pinout
Programming Environment
open Arduino IDE then add the link to ESP library in the preference for Additional Board manager
https://dl.espressif.com/dl/package_esp32_index.json , Then search for the board from board manager and added it ESP3 board wrover module
code
I test it by upload a simple code An LED-blinking
I have a problem with my Arduino software I can’t choose which port is my ESP32 so I search about the problem so I find many people suffering from the same problem the solution is to use a good USB cable some caples it’s cheap and not recognize the microcontroller so I start a big research trip in our lab until I find good one
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(500); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(500); // Wait for two seconds (to demonstrate the active low LED)
video