DAY-01

On the Wednesday of sixth week, Mr. Neil sir conducted our sixth global session. He took the random generator in first 90 minutes. He gave us overall explaination about week-06 which includes Embedded Programming. He tought us different concepts related to Embedded programming includes different types of microcontrollers and their applications, how to program them using different coding environment.
In this assignment, I have made documentation on-
Group Assignment
1. Understanding the datasheets of microcontrollers.
2. Compare the performance and development workflows for other architectures.
Individual Assignment
1. Write a program for a microcontroller development board that you made.
2. Interact (with local input-output devices) and communicate (with remote wired or wireless devices)

DAY-02

Starting with some basic concepts regarding Embedded Programming for better understanding.
Architectures
There are two types of architectures- (a) Von Neumann Architecture and (b) Harvard Architecture
1. Von Neumann Architecture
The Von Neumann Architecture is also known as Von Neumann Model or Princeton Architecture was proposed by John Von Neumann, a Hungarian-American mathematics and physicist in the 20th centuary. Von Neumann Architecture refers to a design model for computers where the processing unit, memory and input-output devices are interconnected through a single, central system bus. The core concept of this architecture is that it has one data path or bus to treat both instructions and data uniformly. This means that the same memory and processing resources are used to store and manipulate both program instructions and the data being processed. This design greatly simplifies the structure and operations of a computer, making it easier to understand and implement.
There are four main components withing the Von Neumann Architecture and they are work together to enable processing, storage and communication within the computer system. They are-
Central Processing Unit(CPU)- The part of a computer that carries out instructions and performs arithmetic, logical and control operations.
Memory- A place where the computer stores and retrievs data and instructions. Memory is divided into two types includes Primary Memory(Random Access Memory-RAM) and Secondary Memory(Hard disk drives).
Input-Output Devices- Components responsible for interfacing the computer with the external world. Examples like keyboard, mouse, printer, monitor,etc.
System Bus- A communication pathway that connects the CPU, memory and I/O devices to enable data and control signals to flow between these components.


Features of Von Neumann Architecture
1) Unified memory structure: Both instructions and data are stored together in the same memory.
2) Sequential instruction processing: Program instructions are executed one after another in a linear sequence.
3) Shared system bus: Components are interconnected through a central communication pathway, allowing for efficient communication and coordination.
4) Modularity: The architecture is suitable for a wide range of computer system, from simple microcontrollers to complex supercomputers by scaling memory and processing capabilities.
Real time examples of Von Neumann Architectureare ENIAC(Electronic Numerical Integrator and Computer), EDVAC(Electronic Discrete Variable Automatic Computer), IBM 701, Intel 4004,etc.

2. Harvard Architecture
Harvard Architecture is a computer architecture that separates the storage and handling of instructions and data using separate memory units and buses for each. This separation provides numerous benefits, including faster execution of instructions and improved overall performance. It enables independant caching of instructions and data. The main components of Harvard Architecture are Instruction memory, data memory, instruction fetch unit and data read-write unit.


Features of Harvard Architecture
1) Separate instruction and data memory units, which store program instructions and data separately.
2) Separate buses for reading instructions and data. enabling simultaneous access to both without any conflict or delay.
3) Faster processing of instructions due to the reduced chance of pipline stalls caused by resource conflicts.
4) Cache memory optimisation, which allows caching of instructions and data independently.
Real time example of Harvard Architecture are digital signal processors, microcontrollers, application-specific integrated circuits, FPGA based processor, etc.

Difference between Von Neumann and Harvard Architecture


Another two types of computer architecture used to design the microprocessors are CISC and RISC in the computer.
What is CISC?
CISC referred as Complex Instruction Set Computer, characterized by a large number of machine instructions, some operating with data in registers and others directly with data in the system's memory. It is mostly used in automation devices. It is basically a computer in which individual instructions may perform many operations and take many cycles to execute. It is used to minimize the number of instructions per program, sacrificing the number of cycles per instruction.
What is RISC?
RISC referred as Reduced Instruction Set Computer, is a type of microprocessor architecture that utilizes a small, highly-optimized set of instructions, rather than a more specialized set of instructions often found in other architectures. Basically, it is a microprocessor that is designed to perform a smaller number of computer instruction types, so it can operate at a higher speed, performing more millions of instructions per second.
Difference between CISC and RISC


Microprocessor
A microprocessor is a computer processor for which the date processing logic and control is included on a single integrated circuit(IC), or small number of ICs. It contains the arithmetic, logic and control circuitry required to perform the functions of a computer's central processing unit(CPU). It can function as the brain of a personal desktop computer. It is used to performs arithmetic and logical operations, provides temporary memory storage and times and regulates all elements of the computer system. It is a programmable, multipurpose, clocl driven, register based electronic devices that reads binary instructions from a storage device called memory, accepts binary data as input and processes data according to those instructions and provides results as output.
Microcontroller
A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. It includes a processor, memory and input/output peripherals on a single chip. It is basically manufactured to control the functions of embedded systems in office machines, robots, home appliances, motor vehicles and number of other gadgets. It is so called microcontroller because this device comprises of transistors which are small in size. A microcontroller is embedded inside of a system to control a singular function in a device. It does this by interpreting data it recieves from its I/O peripherals using its central processor. The temporary information that the microcontroller receives is stored in its data memory. These are used in a wide array of systems and devices. Devices often utilize multiple microcontrollers that work together within the device to handle their respective tasks.
Difference between Microprocessor and Microcontroller



DAY-03

Group Assignment
In this group assignment, we analyzed datasheets of microcontrollers such as Arduino UNO, Arduino ATMega, ESP32 Devkit V1, ESP32 C3 and RP2040. Based on their technical specifications we characterized all the above microcontrollers. Click to read more about Group Assignment.
Individual Assignment
In this assignment, I tested some programs with the PCB board which I made in Week-04 assignment named as Quentorres and also programmed some other microcontrollers with input and output devices.
Now, started with the Quentorres microcontroller.

RP2040

Step 01- Open the Arduino program
In File>Preferences, we will add the URL of the additional boards. We need the Arduino-Pico by Earlephilhower.


Step 02- Boards manager
The next step is to download Pico in the boards manager. Tools>Board>Board manager.


Step 03- Configure the Arduino IDE for the Seeed Studio XIAO RP2040
we configure the Arduino IDE for the Seeed Studio XIAO RP2040. The Seeed Studio XIAO RP2040 will appear in the COM port, in my case in COM 3.


Step 04- Program the IC
I programmed the board to blink all the LEDs, and I also did programming to the push button to toggle the LEDs ON or OFF.


There are some programs that I used to program my board.
Program-01
//This code is written by Siddhi Bodhe #include
const int led1 = 0;
const int led2 = 1;
const int led3 = 26;
const int buttonPin = 27; // Replace with the actual button pin if different
int buttonState = LOW; // Initial button state
bool ledOn = false; // Flag to track LED state
void setup() {
// Set LED pins as outputs
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
// Set button pin as input with internal pull-up resistor
pinMode(buttonPin, INPUT_PULLUP);
// Initially turn off LEDs
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
}
void loop() {
// Read the button state
buttonState = digitalRead(buttonPin);
// Toggle LED state on button press (rising edge)
if (buttonState == LOW && !ledOn) {
ledOn = true;
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
} else if (buttonState == HIGH && ledOn) {
ledOn = false;
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
}
}

Code Explaination:-
The code is intended to control three LEDs using a button. The LEDs are connected to pins 0, 1, and 26, while the button is connected to pin 27 with an internal pull-up resistor enabled. In the setup function, the LED pins are set as outputs and initially turned off (set to HIGH due to the use of active-low logic), and the button pin is set as an input with an internal pull-up. In the loop function, the code reads the button state and toggles the LEDs' state between on and off with each button press. This way, pressing the button toggles the LEDs between on and off.
Output-

Program-02
//This code is written by Siddhi Bodhe #include
const int ledPin = 26;
const int ledPin1 = 0;
const int ledPin2 = 1; // GPIO pin connected to the LED
void setup() {
// Set the LED pin as output
pinMode(ledPin, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
// Turn on the LED
digitalWrite(ledPin, LOW);
delay(50);
digitalWrite(ledPin1, HIGH);
delay(50);
digitalWrite(ledPin2, LOW);
// Wait for a second
delay(100);
// Turn off the LED
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin1, LOW);
delay(50);
digitalWrite(ledPin2, HIGH);
// Wait for a second
delay(50);
}

Code Explaination:-
The code is designed to control three LEDs connected to GPIO pins 26, 0, and 1 on a microcontroller. In the setup function, the code sets these pins as outputs. The loop function then controls the LEDs by turning them on and off in a sequence. Specifically, it first turns on the LED connected to pin 26 and pin 1, then waits for 50 milliseconds. Next, it turns on the LED connected to pin 1 and pin 0, then waits for another 50 milliseconds. After a delay of 100 milliseconds, it turns off the LEDs connected to pins 26 and 0, then waits for 50 milliseconds, and finally turns off the LED connected to pin 1, completing the cycle with another 50-millisecond delay. This results in a blinking pattern for the three LEDs.
Output-

Program-03
//This code is written by Siddhi Bodhe #include
const int ledPin = 26;
const int ledPin1 = 0;
const int ledPin2 = 1; // GPIO pin connected to the LED
void setup() {
// Set the LED pin as output
pinMode(ledPin, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
// Turn on the LED
digitalWrite(ledPin, LOW);
delay(50);
digitalWrite(ledPin1, HIGH);
delay(500);
digitalWrite(ledPin2, LOW);
// Wait for a second
delay(100);
// Turn off the LED
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin1, LOW);
delay(500);
digitalWrite(ledPin2, HIGH);
// Wait for a second
delay(500);
}

Code Explaination:-
This code is designed to control three LEDs connected to GPIO pins 26, 0, and 1 on a microcontroller. In the setup function, these pins are set as outputs. The loop function then creates a sequence for blinking the LEDs. First, it turns on the LED on pin 26 and waits for 50 milliseconds, then turns on the LED on pin 0 and waits for 500 milliseconds, and finally turns on the LED on pin 1 and waits for another 100 milliseconds. After this, the LEDs are turned off in a similar sequence with specific delays: pin 26 is turned off and it waits for 500 milliseconds, pin 0 is turned off with a 500-millisecond delay, and pin 1 is turned off with another 500-millisecond delay. This creates a specific pattern of blinking for the LEDs.
Output-

ESP32 C3


Code:-
#include < LiquidCrystal_I2C.h >
#include < Wire.h >
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin();
// Print a message to the LCD.
lcd.print("Siddhi :)");
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
}

Code Explaination:-
This code is designed to display a message and the elapsed time in seconds on a 16x2 LCD screen connected via I2C. The "LiquidCrystal_I2C" library is included to interface with the LCD. In the setup function, the LCD is initialized and the message "Siddhi :)" is printed on the first row. In the loop function, the cursor is set to the beginning of the second row, and the number of seconds since the microcontroller was reset is displayed, updating continuously. The LCD is connected to the I2C pins on the microcontroller, typically SDA and SCL.
Output:-


Siddhi Bodhe Fab Academy😁