Embedded Programming

Task for Week 4

Group Assignment
- Comparing the performance and development workflows for other architectures
- Documenting the work to the group work page and reflecting on our individual page what we learnt.
Individual Assignment
- Browse through the datasheet for your microcontroller.
- Program a microcontroller development board to interact and communicate

Group Assignment

Link to our group assignment is here

For a beginner, it was fun at the same time intimidating too, seeing all these boards, wires and stuff. Programming word itself seems so alien to me since I've never even learnt the basics of programming. That didn't stop me from exploring.

Explored programming using Arduino Uno and Esp32-s3-WROOM 1 development boards for this weeks assignment.

I was little bit familiar with Arudino Uno but with ESP32, it was my first time getting to know about.

Even though ESP32 seems attractive due to its advanced features like wifi, bluetooth and stuff, for now I would prefer to use Arduino since its user friendly and isn't as complicated as Esp32.

Tinkercad For Circuit Design

Arduino IDE

Individual Assignment

For individual assignment we are asked to browse through the datasheet of the microprocessor that we are using. For my final project I'm thinking of using Esp32 and for this week, I'm using Arduino Uno.

Arduino Uno

Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc.
The architecture of the Arduino Uno is customized Harvard Architecture with 8 bit RISC processor core.
The crystal oscillator present in Arduino UNO comes with the frequency of 16MHz(Clock Speed)
Types Of Memory
Arduino Uno or any other microcontroller has 3 type of memory:
1. Flash
2. SRAM
3. EEPROM
1. Flash
- Where arduino sketch is stored
- The stored content is not lost even when the power is turned off.
- Slower to access than SRAM.
- It generally has 10,000 read/write cycles.
2. SRAM
- It stands for Static Random Access Memory.
- Where the normal variables of the sketch are created, stored and manipulated.
- The stored content is lost when the power is turned off.
- Very quick to access.
- Has practically unlimited read/write access.
3. EEPROM
- It stands for Electrically Erasable Programmable Read Only Memory.
- Can be used to store long term information irrespective of the sketch in the Flash.
- Is the slowest to access among all the 3 memory types.
- It generally has 100,000 read/write cycles.
Arduino Uno has ATmega328p, which has Flash- 32kb, SRAM- 2Kb, EEPROM- 1Kb.
Consists of an USB interface, External Power supply jack,Atmega328, power LED, test LED, ICSP header, Reset button,Digital pins, Power pins, Analog pins, TX/RX LEDs.
Traces Traces
- 6 Analog Input pins which can also used as digital I/O pins.
- 20 digital input pins from which 14 pins are dedicated digital Input and 6 Analog input pins.
- 20 Digital output pins from which 14 pins are dedicated digital output and 6 Analog output pins.
- 6 PWM(Pulse width modulation) pins
- 1 UART port
- 2 I2C port
- 1 SPI port
- 1 RESET pin
- 1 5V pin
- 1 3.3V pin
- 3 GND pins
It supports 3 communication protocols named Serial, 12C and SPI protocols.

Programming Arduino Uno with Arduino IDE

Displaying My Name in LCD

I used LCD to show/display my name on it using Arduino Uno.Since it was my first time using LCD, I did some research on it. LCD that I was using was 16x2 LCD(JHD162A) and this LCD could display 32 Characters.

- The Components used are:
  • Datasheet for Arduino Uno
  • 1. Arduino Uno
    Traces
    2. LCD(16x2)
    Traces
    3. Jumper Wires
    Traces
    - The LCD has 16 pins.
    1. Pin1 of LCD(VSS)- connects to GND
    2. Pin2 VDD(5V)- connects to 5V(Power)
    3. Pin3 VE(Contrast)- will be connected to the resistor(1k Ohm) which will be connected to- GND
    4. Pin4 RS(Register Select)- connected to Digital pin of Arduino
    5. Pin5 RW(read/write)- GND
    6. Pin6 E(enable)- connected to digital pin of Arduino
    7. Pin 11,12,13,14(D4,D5,D6,D7) - will be also connected to digital pin of Arduino
    8. Pin 15 Backlight Cathode - will be connected to 5V
    9. Pin16 Backlight Anode - will be connected to GND
    - After the connections were made, Opened Arduino IDE to do the coding. The code I used is given below. A very simple one.
      #include <LiquidCrystal.h>
      LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // sets the interfacing pins
      
      void setup() { lcd.begin(16. 2); // initializes the 16*2 LCD
      }
      
      void loop()
      {
        lcd.setCursor(0,0); //sets the cursor at row 0 column 0
        lcd.print ("My World"); // prints My World
        lcd.setCursor (0, 1); // sets the cursor at row 1 column 2
        lcd.print ("Karma Lhakee"); // prints my name Karma Lhakee
      
      }
      
      
    - The digital pin that I used in the LCD are No. 12,11,5,4,3 and 2.
    - The first lcd.setCursor(0,0) means the word/character will start from 0 Row and 0 Column which is MY WORLD.
    - The second lcd.serCursor(0,1) means the character designated will start from Row 1 and Column 2 which is my name Karma Lhakee.
    - The output display is shown below.
    Traces

    LCD with Serial Monitor

  • Here is a video of the LCD responding to the Serial Monitor.
  • ESP32 Datasheet

    Datasheet for Esp 32
    1. It is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode bluetooth.
    Traces
    2. ESP32 is designed for mobile, wearable electronics and IoT applications. It is the most integrated solution for Wi-Fi+ Bluetooth applications in the industry with less than 10 external components.
    3. Its main processor is Tensilica Xtensa 32-bit LX6
    4. All versions of the ESP32 series are dual-core except for ESP32-SOWD, which is a single core.
    5. It has clock frequency up to 240 MHz.
    6. It also has a performance up to 600 DMIPS.
    Traces
    7. Wirless Connectivity:
    A. Wi-Fi: 802.11 b/g/n/e/i(802.11n @ 2.4 GHz up to 150 Mbit/s)
    B. Bluetooth: v4.2 BR/EDR and Bluetooth Low Energy(BLE)
    8. Memory
    A. ROM: 448 KB - For booting and core functions.
    B. SRAM: 520 KB - For data and instruction.
    C. RTC fast SRAM: 8 KB- For data storage and main CPU during RTC Boot from the deep-sleep.
    D. RTC slow SRAM: 8 KB - For co-processing accessing during deep-sleep mode.
    E. Embedded Flash: 0 MB((ESP32-D0WDQ6, ESP32-D0WD, and ESP32-S0WD chips), 2MB(ESP32-D2WD chip), 4MB(ESP32-PICO-D4 SiP module).
    F. External flash and SRAM: supports upto 16 MB.
    Traces

    Perks Of ESP32

    • With so many amazing features, it would seem that ESP32 would cost fortune but surprising it is quite reasonable. ESP32 dev modules cost in the ballmark of Nu.500/-.
    • The Chip dimensions are also quite small(25mm x 18mm) including the antenna area allowing its use in devices requiring a very small form factor.
    • ESP32 can be programmed using the Arduino IDE making the learning experience convenient and comfortable.