Skip to content

Starting with embedded

Posted on:May 16, 2023 at 08:15 AM

Embedded is basicly the boundary between programming and electronics. You can create a custom Arduino or Raspberry Pi using the AVR and ARM processors with some auxilliary circuits and then program it.

For beginners, Arduino is recommended. It doesn’t have a very powerful processor - the “CPU clock” runs at only 16MHz, but it’s perfect for small projects like a soap dispenser using infrared sensor or even some complicate ones like a door lock using an RFID reader.

To start with an Arduino Uno, purchase one for about $20(original) or less than $10(China). Then install Arduino IDE and select board “Arduino Uno” and the respective port. A full tutorial can be found here

A new project will loke like this:

void start() // runs once
{

}

void loop() // runs in a loop
{

}

This ressembles C, but there is no main function because the compiler adds it for you:

int main()
{
    start();
    while(true)
        loop();
    return 0;
}

For blinking a led you need to set the mode to output pinMode(2, OUTPUT) and send high and low values with a delay between like:

void loop()
{
    digitalWrite(2, HIGH);
    delay(400);
    digitalWrite(2, LOW);
}

Other important function is the tone. You can connect a buzzer to pin 4(or any pin) and use this function to make it create sounds.

void loop()
{
    tone(4, 1000);
    delay(200);
    noTone(4); // ends the tone
}

For more advanced engineers here, buying DIY soldering projects and then integrate it with arduino can be a massive step forward. For example, you can create a pulse generator and connect it to a buzzer and get power from Arduino. (you can buy one from here - AliExpress)