You Want Electronic Components for your project. 

For more information, contact us at: 

2.4. Code simulation in simulation software34

2.4.1. Introduction to code simulation

Code simulation is the process of running and testing a program for a microcontroller or embedded system inside simulation software, without necessarily using the real physical hardware.

It allows a designer or learner to check whether the code, circuit, sensors, actuators, and microcontroller work correctly before building the actual circuit.

Common simulation software

Some commonly used tools for embedded-system code simulation include:

  • Proteus :widely used for simulating Arduino, PIC, AVR, 8051 and other microcontroller circuits.
  • Wokwi : web-based simulator for Arduino, ESP32, Raspberry Pi Pico and other boards.
  • Tinkercad Circuits : useful for beginners learning Arduino and basic electronics.
  • MATLAB/Simulink : used for more advanced control and embedded-system simulations.
  • Multisim : mainly used for electronic circuit simulation.

Example by using Proteus

Suppose you want to control an LED using an Arduino.

The process is:

1. Write the Arduino code

int LED = 13;

void setup() {

pinMode(LED, OUTPUT);}

void loop() {

digitalWrite(LED, HIGH);

delay(1000);

digitalWrite(LED, LOW);

delay(1000);}

2. Compile the code

In Arduino IDE, compile the program to generate the compiled file, commonly a .hex file for suitable Arduino/AVR simulation workflows.

3. Build the virtual circuit in Proteus

You can place:

  • Arduino board/microcontroller
  • LED
  • Resistor
  • Ground
  • Power connections

4. Load the compiled program

In the simulated microcontroller’s properties, select the generated program file.

5. Start the simulation

When you press Run, the virtual Arduino executes the program.

The LED should:

  • turn ON
  • remain ON for 1 second
  • turn OFF
  • remain OFF for 1 second
  • repeat continuously.

Importance of code simulation

Code simulation helps learners and engineers to:

  • Test programs before using real hardware.
  • Detect programming errors.
  • Detect circuit connection errors.
  • Observe sensor and actuator behavior.
  • Save components and development costs.
  • Reduce the risk of damaging expensive components.
  • Experiment with different circuit designs.
  • Understand the interaction between software and hardware.

Embedded-system development process

Requirement → Circuit Design → Code Development → Simulation → Debugging → Hardware Implementation → Testing

For example:

Arduino + Temperature Sensor + Fan

You can first simulate the entire system:

Temperature Sensor → Arduino → Program → Transistor/Relay → Fan

⚠

Note: Simulation is not always identical to real hardware. Real components have tolerances, noise, delays, power limitations, and physical effects that may not be perfectly represented by the simulator.

🎥 Watch the Video

MIGABO Emmanuel is an experienced Technical and Vocational Education and Training (TVET) instructor and engineering trainer with extensive experience in Electronics, Telecommunication, Computer Systems, Embedded Systems, and Information Technology. Since 2017, he has been delivering competency-based technical education and practical skills training in different educational institutions, preparing learners for careers in engineering and modern technology.

Throughout his teaching career, he has worked in various departments, including Computer Systems, Electronics and Telecommunication, Electrical Technology, and related engineering fields. He has taught learners from different academic levels using practical, project-based, and competency-based training approaches that combine theory with hands-on laboratory experience.

His teaching expertise covers a wide range of technical subjects, including:

C Programming
C++ Programming
Python Programming
Arduino IDE Programming
Embedded Systems Development
Microcontroller Programming
Electronics Fundamentals
Digital and Analog Electronics
Electrical Installation and Basic Electricity
Motherboard Design and Production
Electronic Equipment Repair and Maintenance
Enclosure Design and Production
PCB Design and Manufacturing
CCTV Camera System Installation and Configuration
Fire Detection and Alarm System Installation
Computer Hardware and Maintenance
Computer Networking Fundamentals
Sensors and Actuators
Internet of Things (IoT) Fundamentals
Technical Drawing and Engineering Documentation

In addition to classroom instruction, he has supervised numerous practical projects involving embedded systems, electronics prototyping, automation, hardware troubleshooting, and electronic product development. His training philosophy emphasizes innovation, critical thinking, problem-solving, teamwork, and industry-relevant practical skills.

He is proficient in various engineering and programming tools, including Arduino IDE, Proteus, KiCad, EasyEDA, SolidWorks, Fusion 360, and several C/C++ development environments. His interests include embedded system optimization, digital manufacturing, CAD/CAM technologies, Internet of Things (IoT), robotics, and industrial automation.

Committed to lifelong learning and professional excellence, MIGABO Emmanuel continues to develop modern training materials, competency-based curricula, and practical laboratory exercises that equip learners with the knowledge and technical skills required by today's rapidly evolving technology industry.