Game of codes, my microcontrollers quest so far (LBYMF3C)
TARGET AUDIENCE: Self, Students, Academics, Industry Professionals, Employers, and Tech Enthusiasts
OVERVIEW: One of the skills that is heavily asked by employers in our field is the need to code embedded systems that are often seen in the plant and other task that may fall under a manufacturing engineer’s lap. As an overview and sort of crash course to this, there is a lab that formally introduces us to these concepts and principles. This course on Microprocessor and Microcontroller Systems (LBYMF3C) gave me practical experience in applying C programming to embedded systems. Through a mix of simulation, coding, and hardware-based activities, I explored how microcontrollers interact with sensors, actuators, and real-world inputs.
The lab exercises followed a progression: starting with fundamentals of programming and logic, then moving toward peripheral interfacing, and finally, integrated projects that simulated real engineering systems.
🧪 Lab Exercise Highlights
1. Introduction to Microcontrollers and C Programming
- Learned the structure of C programs for microcontrollers.
- Worked with basic I/O operations: toggling LEDs, reading button states.
Formula: Voltage divider for digital input reading
\(V_{out} = V_{in} \cdot \frac{R_2}{R_1 + R_2}\)
2. Logic Implementation and Truth Tables
- Implemented Boolean logic using C conditions.
- Designed truth tables for AND, OR, and NOT operations.
Example (Boolean Algebra):
\(Y = A \cdot B \quad \text{(AND Gate)}\)
\(Y = A + B \quad \text{(OR Gate)}\)
3. Timers and Counters
- Used timer registers to generate delays and count events.
- Simulated real-time delays for LED blinking and pulse counting.
Timer Formula:
\(T_{delay} = \frac{(MaxCount - InitialValue) \cdot Prescaler}{f_{osc}}\)
4. ADC (Analog-to-Digital Conversion)
- Read sensor data (e.g., temperature, potentiometers).
- Converted analog signals into digital values for processing.
ADC Conversion Formula:
\(DigitalValue = \frac{(V_{in}) \cdot (2^n - 1)}{V_{ref}}\)
Where:
- \(n\) = ADC resolution (bits)
- \(V_{ref}\) = reference voltage
5. PWM (Pulse Width Modulation) Control
- Generated PWM signals to control motor speed and LED brightness.
- Learned duty cycle adjustments for actuator control.
Duty Cycle Formula:
\(D(\%) = \frac{T_{on}}{T_{on} + T_{off}} \cdot 100\)
6. Serial Communication (UART)
- Used UART to transmit and receive data between the microcontroller and PC.
- Applied baud rate settings to match communication speed.
Baud Rate Formula:
\(BaudRate = \frac{f_{osc}}{16 \cdot (UBRR + 1)}\)
7. Integrated Final Project
- Combined I/O, ADC, PWM, and serial communication.
- Applied sensor-actuator feedback loop for a working system.
- Example: reading temperature and activating a fan when a threshold is reached.
Control Logic (Pseudo-Equation):
\(\text{If } T > T_{threshold} \quad \Rightarrow \quad Fan = ON\)
Provided below is the reports that I have made that details my domain knowledge for this course.
REFLECTIONS: I still remember my pair at the start of the term asking me why I was trying to study ALUs, bit registrars and other CPU components seen in MCUs. I said I was preparing myself for this course since I really want to absorb as much on this oppurtunity. Turns out, I know more about these concepts (now, forgotten, mind you) through self-study than the instructors herself!! She was non-existent and only showed up after mid week of the term while we were teaching ourselves how to do the lab exercises that we even had to beg to have HAHA
Anyways, I know th was a rudimentary introduction of the concepts that is needed for fully-fledged embedded systems engineers out in the field. I know for a fact that they are using different IDEs
, doing HDL-programming
, Verilog
, Bare-metal programming
. This was different from my expectations on the difficulty that I wanted but then again this goes and intersects with the job of electronics engineers
. Not something that us MEM majors will do and thats perfectly fine! The term was hard so this was a blessing in disguise. With that I will look back on this course knowing what further applications that I can do and learn if I want to head to that path of becoming an embedded systems engineer
.
Overall, after this experience, I’m confident that I got to have the following skills:
- C for Embedded Systems: I gained confidence in writing optimized, hardware-level code.
- Peripheral Interfacing: Learned how to connect sensors, actuators, and communication modules effectively.
- Debugging Skills: Encountered and solved hardware/software mismatches (e.g., baud rate errors, pin mapping).
- System Thinking: Developed small-scale cyber-physical systems by combining code with electronics.
Enjoy Reading This Article?
Here are some more articles you might like to read next: