MODULE INFORMATION
❑LECTURER INFORMATION:
❖ Eric NGABOYERA And Alphonse MUNEZERO
Embedded Systems 10/14/2024
RETES801 - EMBEDDED SYSTEM FOR RENEWABLE
ENERGY
OUTCOMES
❑ APPLY PYTHON PROGRAMMING FOR EMBEDDED SYSTEM
❑ DEVELOP AN EMBEDDED SYSTEM PROJECT
❑ DESIGN PCB FOR RENEWABLE ENERGY SYSTEM
10/14/2024
Embedded Systems
WHY WE'RE USING C INSTEAD OF
PYTHON
1. Compatibility with Hardware 6. Hands-on Experience
2. Learning Curve 7. Advanced Features
3. Resource Efficiency 8. Project Focus
4. Performance 9. Long-Term Skill Development
5. Support for Beginners
Embedded Systems 10/14/2024
DEVELOP AN EMBEDDED SYSTEM
PROJECT
Embedded Systems 10/14/2024
ORIGIN OF ARDUINO IDE
• ARDUINO was developed in Italy in 2005 to make it easier for students,
artists, and non-engineers to interact with electronics.
• Arduino IDE primarily uses C/C++ with slight modifications and
simplifications (such as automatic code structuring, function declarations,
etc.), making it more beginner-friendly.
• It provides a cross-platform interface (Windows, macOS, Linux), making
programming accessible on multiple operating systems.
Embedded Systems 10/14/2024
COMPARISON TO OTHER LANGUAGES
• The core language in Arduino is essentially C/C++ Functions like setup()
and loop() are part of the simplifications introduced in the IDE.
• Unlike C/C++, Python is an interpreted language and is easier to read
and write.
• However, for microcontrollers (like Arduino), Python isn't natively
supported. Projects such as MicroPython enable Python on more
advanced microcontrollers (e.g., ESP32, Raspberry Pi Pico), but Arduino
IDE sticks to C/C++ for efficiency and real-time control.
Embedded Systems 10/14/2024
WHY ARDUINO IDE
• Arduino simplifies many complexities of C/C++, making it
approachable for beginners.
• Arduino has a vast library ecosystem and strong community support,
making it easier to find resources and help.
Embedded Systems 10/14/2024
FEATURES OF ARDUINO IDE
• Code Editor
• Compiler
• Serial Monitor
• Libraries
• Board Manager
• Port Selection
Embedded Systems 10/14/2024
ARDUINO IDE WORKFLOW
• Writing the Sketch (Program)
✓ Set up()
✓ Loop()
• Verify/Compile
• Upload
• Monitor
Embedded Systems 10/14/2024
HOW THE ARDUINO IDE DIFFERS FROM
OTHER IDES
• Simple Interface
• Focus on Hardware Interaction
• Code Structuring
Embedded Systems 10/14/2024
ARDUINO CODE STRUCTURE AND
KEY FEATURES OVERVIEW
Feature Example
Declarations const int ledPin = 13;
Function pinMode(ledPin, OUTPUT);
Function digitalWrite(ledPin, HIGH);
Pin Mode Declaration pinMode(ledPin, OUTPUT);
Output Operations digitalWrite(ledPin, HIGH);
Timing (Delays) delay(1000);
Serial Communication Serial.begin(9600);
(Optional) Serial.println("Turning LED ON");
Compilation Click "Verify" button in the Arduino IDE.
Uploading Click "Upload" button in the Arduino IDE.
Embedded Systems 10/14/2024
TYPES OF SENSOR DATA IN ARDUINO
PROJECTS
• Analog Sensor Data
✓ Analog sensors produce a continuous range of values, typically between 0
and 1023 on a 10-bit scale in Arduino
✓ Representing the range of voltage levels between 0V and 5V (or 3.3V
depending on the board).
✓ Example; Temperature sensors, Light sensors, Force/Pressure sensors
✓ Reading: analogRead();
Embedded Systems 10/14/2024
• Analyzing Data
✓ Scaling: Convert the raw analog reading to meaningful units (e.g.,
temperature in °C or light intensity in lux).
✓ Smoothing: Use averaging techniques to remove noise from sensor
readings.
✓ Thresholding: Apply thresholds to detect significant events (e.g.,
temperature above a certain value).
• Digital Sensor Data
✓ Digital sensors provide binary output (HIGH/LOW) or serial data in
a digital format (e.g., I2C, SPI, UART communication).
✓ Example; Digital temperature/humidity sensors, Motion sensors,
Proximity sensors
Embedded Systems 10/14/2024
• Pulse-Width Modulation (PWM) Data
✓ Some sensors or actuators use PWM signals, which are digital
signals that encode information by varying the pulse width of the
signal.
✓ Example; Distance sensors, Servos, and motor control
✓ How to Analyze: Analyze PWM signals using pulseIn() to measure
the width of high or low pulses in microseconds.
Embedded Systems 10/14/2024
PINOUT CONFIGURATION FOR COMMON ACTUATORS,
SENSORS, AND COMMUNICATION MODULES WITH ARDUINO
Compone Sub-Components Arduino Pinouts
nt
Servo SG90 (or similar) - Signal: Digital Pin (e.g., D9), Power: 5V
Motor - Ground: GND
Water Solenoid Valve - Control Relay: Digital Pin (e.g., D8), Power:
Valve 12V (from external supply), Ground: GND
Water Diaphragm Pump - Control Relay: Digital Pin (e.g., D7), Power:
Pump 12V (from external supply), Ground: GND
Bluetooth HC-05 or HC-06 - TX: D0 (RX), RX: D1 (TX), Power: 5V
Module - Ground: GND
Relay For controlling high- - Control Pin (for Valve): Digital Pin (e.g., D8)
Module power devices - Control Pin (for Pump): Digital Pin (e.g., D7)
- Power: 5V, Ground: GND, C/NO (as needed)
Embedded Systems 10/14/2024
Questions and Discussions
END
Embedded Systems 10/14/2024