Assignment to be done:
1.Group Assignment
Compare the performance and development workflows for other architectures
To be found here
2.Individual Assignment
.
Browse through the data sheet for your microcontroller program a microcontroller development board to interact (with local input &/or output) and communicate (remotely) extra credit: use different languages &/or development environments
1.Group Assignment.
2.Individual Assignment.
Short notes on Embedded Programming and Microcontroller
What is embedded Programming?:
Embedded programming is a specific type of programming that supports the creation of
consumer facing or business facing devices that don't operate on traditional operating systems the way that
full-scale laptop computers and mobile devices do. The idea of embedded programming is part of what drives
the evolution of the digital appliances and equipment in today's IT markets.
Embedded programming is also known as embedded software development or embedded systems programming.
Reference from here
What is Microcontroller?:
A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system.
A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.
Sometimes referred to as an embedded controller or microcontroller unit (MCU), microcontrollers are found in vehicles,
robots, office machines, medical devices, mobile radio transceivers, vending machines and home appliances, among other devices.
They are essentially simple miniature personal computers (PCs) designed to control small features of a larger component, without a complex front-end operating system (OS).
Reference from here
The first task was to download a Microcontroller IDE from https://www.arduino.cc/en/donate/ by clicking
on JUST DOWNLOAD
int led=18;
void setup()
{
pinMode(led, OUTPUT);
}
void loop()
{
digitalWrite(led, HIGH);
delay(2000);
digitalWrite(led, LOW);
delay(500);
}
Hardware implementation
Afeter programming in arduino IDE, you verify by compiling your code, if there are errors you debug them.If no error, you connect your microcontroller board
to your computer through its dedicated USB and upload the codes in its memory.Then after, connect a LED via a protective resistor to limit
the current that can destroy a LED to the chosen
pin of esp32 here is pin18 as it is the one I chose and declared in my codes.
Image above shows hardware implementation of a Blinking a LED using the ESP32 microcontroller
Programming of a Traffic Light using EsP32
Programming a traffic light using ESP32 has been done using the following steps:
int green=21;
int orange=19;
int red=18;
void setup(){
pinMode(green, OUTPUT);
pinMode(orange, OUTPUT);
pinMode(red, OUTPUT);
}
void loop(){
digitalWrite(green, HIGH);
delay(2000);
digitalWrite(green, LOW);
digitalWrite(orange, HIGH);
delay(1000);
digitalWrite(orange, LOW);
digitalWrite(red, HIGH);
delay(6000);
digitalWrite(red, LOW);
}
Below video uploaded on youtube is of traffic light using ESP32.
The above works were about programming the outputs devices.
Programming input devices
Programming input devices in a microcontroller is important because it enables the microcontroller to receive and respond
to input signals from various devices such as sensors, switches, and buttons. The input signals can provide valuable
information about the state of the external environment or user interaction, which can be used to control the behavior of the microcontroller and perform various tasks.
They are many reasons why programming input devices in a microcontroller is important such as:
Sensing and measurement: Many microcontroller-based systems use sensors to measure physical parameters such as temperature,
pressure, and light intensity. The microcontroller can read the sensor data and use it to control other parts of the system, such as turning on a fan to cool down a device if the temperature is too high.
User interaction: Microcontrollers are often used in devices that require user input, such as remote controls, game controllers, and keypads. The microcontroller can read the user input and perform the appropriate action, such as changing the channel on a TV or moving a character in a game.
Automation and control: Microcontrollers are widely used in industrial and automation systems to control various processes and machines. Inputs from sensors and switches can be used to monitor the state of the system and adjust the control parameters accordingly.
Security and safety: Input devices can also be used for security and safety purposes. For example, a microcontroller-based security system can use inputs from sensors and switches to detect intrusion or fire and trigger an alarm or activate a sprinkler system.
In summary, programming input devices in a microcontroller is essential for enabling the microcontroller to interact with the external environment, perform various tasks, and ensure the safety and security of the system.
Steps for Programming a push button using EsP32 to control a LED:
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);
}
}
#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("espCHRIS"); //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);
}
}
Below video uploaded on youtube is of controlling LEDs trough bluetooth using ESP32 . 2023 All Rights Reserved. Designed by Felix NYIRIGIRA