Back to Weekly Assignments

Week 4: Embedded Programming

Group Work Assignment Reflection

As part of the group assignment, we compared the programming workflows, tool-chains, and communication interfaces of several microcontroller families available in the lab. Full documentation — including side-by-side comparisons of Arduino, ESP32, and RP2040 — is on the group page:

  • Week4 Group Assignment - Our group assignment webpage
  • Individual Assignment

    This week, I helped Grade 2 students turn their handmade bridges into auto-lifting bridges by showing them what coding is, how programming drives a servo motor, what Arduino is, and how it works.

    I was also explore what is ESP32 how powerful it is including spercifications,features power pins

    Workflow

    1.Arduino workflow: I tested on the cirkit designer by adding the components and then make the simulation. The Servo library is included to control the Servo motor. The Servo is attached to pin D5. The setup() function initializes the Servo at 0 degrees. The loop() function gradually moves the Servo to 45 degrees and then back to 0 degrees, with a delay to control the speed of rotation.

    What is Arduino? Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino consists of both a physical programmable circuit board (often referred to as a microcontroller) and a piece of software, The software, called the Arduino programming language, includes built-in syntax rules and a library of pre-written code that simplifies the process of creating a program. The board’s versatility allows it to be used in a wide range of applications, from simple projects to complex systems.

    Description of image

    What is servo motor and what does it do? How Servo Motors work and how to control servos using Arduino.

    servo motor is a special type of motor designed for precise control of angular position. It is an automatic device that uses a feedback system to correct its performance. Unlike a standard DC motor which just spins continuously, a servo motor can be commanded to move to a specific angle and hold that position against external forces.

    Description of image Servo bridge animation (GIF)
    Handmade Bridge
    This is an image of the handmade bridge,servo and Arduino,when the battery turn on, the briage will auto-lifting and drop down slowlly.

    2.What is ESP32? ESP32 is highly-integrated with in-built antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules.

    ESP32 adds priceless functionality and versatility to your applications with minimal Printed Circuit Board (PCB) requirements. Hybrid Wi-Fi & Bluetooth Chip.

    Description of image

    This week, I worked on using Arduino to build an auto-lifting bridge and explored how to use the ESP32.

    Useful links

    Arduino Code Wiring Connections

                        #include 
    
                            Servo myServo;  // Create a Servo object
                            
                            void setup() {
                              myServo.attach(5);  // Attach the Servo to pin D5
                              myServo.write(0);   // Start at 0 degrees
                              delay(1000);        // Wait for the servo to reach the position
                            }
                            
                            void loop() {
                              // Rotate to 45 degrees slowly
                              for (int pos = 0; pos <= 45; pos++) {
                                myServo.write(pos);  // Move to the position
                                delay(15);           // Wait for the servo to reach the position
                              }
                              
                              delay(1000);  // Hold at 45 degrees for a second
                            
                              // Return to 0 degrees slowly
                              for (int pos = 45; pos >= 0; pos--) {
                                myServo.write(pos);  // Move to the position
                                delay(15);           // Wait for the servo to reach the position
                              }
                            
                              delay(1000);  // Hold at 0 degrees for a second
                            }
                    

    Gallery

    Description of image Description of image
    Handmade Bridge
    This is an image of the handmade bridge,servo and Arduino,when the battery turn on, the briage will auto-lifting and drop down slowlly.

    Video

    Week 4 Auto-lift
    Auto-lifting bridge demo with Arduino and servo motor.