Week 4:Embedded Programming

Assignment activities

1.Individual Assignment.

.browse through the data sheet for your microcontroller

.program a microcontroller development board to interact and communicate.

2.Group Assignment.

.compare the performance and development workflows for other architectures

Here you can access the group assignment in details here

Embedded Programming: 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.It is embedded as part of a complete device often including electrical or electronic hardware and mechanical part, Because an embedded system typically controls physical operations of the machine that it is embedded within, it often has real-time computing here

I was eager to start this week because of embedded programmming though it was quite difficult for me because was my first time to use electronic softwares and devices but luckily Arduino was quite similar to C and C++ programming language and I was used in c and c++, I runned basics faster and I wish to make progress on this new journey of electronics , so that at the end i combine mechanical and electronics since they work together.


1.Individual Assignment.

During group review our colleagues who studied electronics have played big role in giving us the whole picture of the electronics starting with the simple circuit until the general idea of Arduino, this was nice background for us to go ahead and make the research to improove my skills regarding eectronics.

I.Browse Through The Data Sheet For Your microcontroller

It was really challenging to start reading datasheet without knowing the key features of the Microcontroller,However on Saturday during Global Open Sesseion I got the whole concept of Microcontroller and I managed to get highlight what I read in datasheet as in the key features.

In my first implementation I used ESP32 as my Microcontroller,and the next step was to read datasheet of ESP32,Basically he ESP32 is a microcontroller designed by Espressif Systems, which is used for a wide range of applications including IoT, automation, and robotics.

datasheet is basically A datasheet for a microcontroller (MCU) provides detailed technical information about the device, including its electrical and physical characteristics, functional description, pin assignments, memory organization, peripheral interfaces, power consumption, and programming information.

Specifically since I used ESP32 as my Microcontroller, and it's description is Below;

II.program a microcontroller development board to interact and communicate.

It was almost 2 years to hear Arduiono software which can be used in control of the boards which can be used like designing the Robot and other automated devices,I was really to see my codes running in Arduino and LED lighting say WOOW it runs.

We started on basics of electronics and we proceeded with Microprocessor and Microcontroller ,the major difference I will always was that on the Microcontroller its CPU in single chip(all memories are internally equiped) and Microprocessor its CPU server and several support memories(all Memories are externally equiped)

and also types of the memory like :flash memory(for programs),SRAM(For currently working softwares,temporary working),EEPROM(for keeping files permanently)

We review the syntax and some basic keywards which are used in Arduino, because in the electronic softwares I prefered to use Arduino since it's the one I heard before and in our country its the commonly used software in electronics.

The next step was to download Arduino setup for and it firstly become challenging , because I download the running app and once i was updated the drivers failed to be installed in my pc,

Below are the steps I followed while i was installing and starting Arduino software.

After finishing adding the ESP32 board in the Arduino IDE,I proceeded programming and linking the devices with their output.


Output Microcontroller development board to interact With Arduino

The first step I did is the output, I programmed codes using Arduiono Language with ESP32 Microcontroller, Below are steps I passed while blinking the LED

Creating the new document, and select the port and board I am using while programming , my board is ESP 32 DEVKIT V1 and the port is com3.

After the configuration of port and board, the Source Code i Programmed for displaying the blinking Leds are below;


int red= 23;
int red1= 22;
int green1= 21;
int yellow= 19;
int yellow1= 18;
int white= 5;
int white1=15;
void setup() {
pinMode(red,OUTPUT);
pinMode(red1,OUTPUT);
pinMode(green1,OUTPUT);
pinMode(yellow,OUTPUT);
pinMode(yellow1,OUTPUT);
pinMode(white,OUTPUT);
pinMode(white1,OUTPUT);
}
void loop() {
digitalWrite(red,HIGH);
delay(1500);
digitalWrite(red,LOW);
digitalWrite(red1,HIGH);
delay(1500);
digitalWrite(red1,LOW);
digitalWrite(green1,HIGH);
delay(1500);
digitalWrite(green1,LOW);
digitalWrite(yellow,HIGH);
delay(1500);
digitalWrite(yellow,LOW);
digitalWrite(yellow1,HIGH);
delay(1500);
digitalWrite(yellow1,LOW);
digitalWrite(white,HIGH);
delay(1500);
digitalWrite(white,LOW);
digitalWrite(white1,HIGH);
delay(1500);
digitalWrite(white1,LOW);
  }

For the final output LED blinking the photo is below.

And this is video when it was working , Woow it's really amazing, This was my desire to use Arduino and program running project.


Input Microcontroller development board to interact with Arduino

The Second step I did is to interact by input command,I programmed codes using Arduiono Language with ESP32 Microcontroller, Below are steps I passed while blinking one LED by using button.

Creating new document as I did for output and then configure the board(ESP 32 DEVKIT V1) and port(COM3)


  int led=19;
  int button=18;
  int button_bit;
  void setup() {
   Serial.begin(9600);
   pinMode(led,OUTPUT);
   pinMode(button,INPUT);
   }
  void loop(){
  button_bit= digitalRead(button);
  Serial.print(button_bit);
  delay(100);
  if(button_bit == 1){
    digitalWrite (led,HIGH);
   }
   else{
   digitalWrite (led,LOW);
   }
  }

COMMUNICATING REMOTELY BY USING BLUETOOTH MODE

The next is to communicate Remotely i used bluetooth Mode, and below are the steps I used to reach this connection.

The next step is to modify the syntax and blink the LED remotely by bluetooth mode, below are the codes


  #include "BluetoothSerial.h"

  #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
  #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
  #endif
  byte light;
  BluetoothSerial SerialBT;

  void setup() {
  Serial.begin(115200);
  SerialBT.begin("esp32Test"); //Bluetooth device name
  Serial.println("The device started, now you can pair it with bluetooth!");
  pinMode(19, OUTPUT);
  }

  void loop() {
  if (SerialBT.available()) {
  light = SerialBT.read(); 
  delay(20);
  }

  if (light == '1'){
  digitalWrite(19, HIGH);
  }
   else if (light == '0'){
  digitalWrite(19, LOW);
  }

}