CODING CELEBRATION FOR ARDUINO – SCOPES-DF

Lesson Details

Age Ranges *
Fab Tools *
Author
Additional Contributors

Author

Studio 5
Studio 5
Other
In line with the Ministry of Communications and Information Technology’s Digital Youth Strategy, STUDIO 5 is mainly aimed at nurturing youth as digital learners by sharpening their 21st century learning skills, as they develop in an all-pervasive digital environment. In… Read More

Summary

This workshop aims to teach participants into being confident creating a virtual Arduino circuit using Wokwi as an online simulator for hardware and coding. In addition participants will have an “Open-Eye” on many different aspects of coding, other than apps and software, to create a fun design and activity using Arduino

What You'll Need

Projector/Screen, Laptop, Internet Access

Lesson Materials:

Presentation

Lesson Plan English

Lesson Plan Arabic

Demo Video

Learning Objectives

After attending this session, participants will gain:

  • What is Arduino, What is Wokwi
  • How to create an Arduino based project with Arduino Uno, Buzzer and Potentiometer
  • How to connect all components.
  • How to code tones we need to play as a Happy Birthday sequence.
  • How to code the Potentiometer to modify the song speed.

 

Reflection

This session depends a lot on discussion and student input and work.

The Instructions

Presentation

A quick introduction about us and a way to break the Ice with the participant in order to engage with them in indirect way just to make a conversation and then a question to start the session.

Introduction & Icebreaking

1- Introduce yourself and Studio5. 

2- ask about Arduino in general. 

 

Presentation :

A close up of a logo

AI-generated content may be incorrect.

1- What is Arduino? introduce Wokwi

A screenshot of a computer

AI-generated content may be incorrect.

2- How to signup/login to Wokwi?

3- How to use Wokwi?

4- What are the extra features on Wokwi. 

5- Who to create an Arduino based project with Arduino Uno, Buzzer and Potentiometer.

6- Let’s create the Happy Birthday Arduino circuit. 

 

A diagram of a blue circuit board

AI-generated content may be incorrect.

Instructions

We will start by showing how to access Wokwi.

A screenshot of a computer

AI-generated content may be incorrect.

How to create project.

A screenshot of a computer

AI-generated content may be incorrect.

How to use component.

Screenshot of a computer program

AI-generated content may be incorrect.

 

A screenshot of a computer

AI-generated content may be incorrect.

How to create C loops.

A screenshot of a computer

AI-generated content may be incorrect.

How to create C Arrays

A screenshot of a computer

AI-generated content may be incorrect.

How to manage the Arrays and Tones.

How to handle different song speed using Potentiometer.

A screenshot of a computer

AI-generated content may be incorrect.

 

A screenshot of a computer

AI-generated content may be incorrect.

How to create the final outcome, Happy Birthday Arduino Circuit (Demo Video)

 

 

 

Full Arduino Code

int buzzerPin = 10;

int potPin = 0;

 

float potValue = 0.0;

float songSpeed = 1.0;

 

#define N_C4 262 //DO

#define N_D4 294 //RE

#define N_E4 330 //MI

#define N_F4 349 //FA

#define N_G4 392 //SOL

#define N_A4 440 //LA

#define N_B4 494 //SI

#define N_C5 523 //DO

#define N_D5 587 //RE

#define N_E5 659 //MI

#define N_F5 698 //FA

#define N_G5 784 //SOL

#define N_A5 880 //LA

#define N_B5 988 //SI

 

// G G A G C B  — SOL SOL LA SOL DO SI

// G G A G D C  — SOL SOL LA SOL RE DO

// G G G E C B A — SOL SOL SOL MI DO SI LA

// F F E C D C  — FA FA MI DO RE DO

 

int b_day_notes[] = {

  N_G4, 0, N_G4, N_A4, N_G4, 0, N_C5, N_B4, 0,

  N_G4, 0, N_G4, N_A4, N_G4, 0, N_D5, N_C5, 0,

  N_G4, 0, N_G4, N_G5, N_E5, N_C5, N_B4, N_A4, 0,

  N_F5, 0, N_F5, N_E5, N_C5, N_D5, N_C5, 0

};

 

int note_duration[] = {

    250, 125, 125, 500, 500, 25, 500, 500, 500,

    250, 125, 125, 500, 500, 25, 500, 500, 500,

    250, 125, 125, 500, 500, 500, 500, 500, 500,

    250, 125, 125, 500, 500, 500, 500, 500

    };

 

void setup()

{ potValue = analogRead(potPin);

  songSpeed = mapfloat(potValue , 1, 1023, 0.7, 1.5);

  }

void loop()

{

  int totalNotes = sizeof(b_day_notes) / sizeof(int);

  for (int i = 0; i < totalNotes; i++)

  { int currentNote = b_day_notes[i];

    float wait = note_duration[i] / songSpeed;

    potValue = analogRead(potPin);

    songSpeed= mapfloat(potValue , 1, 1023, 0.7, 1.5);

 

    if (currentNote != 0) // Play tone if current Note is not 0 HZ

    { // tone(pin, frequency, duration)

      tone(buzzerPin, b_day_notes[i], wait);  }

    else

    {   noTone(buzzerPin);  }

    delay(wait); // delay between tones

  }

}

 

 

float mapfloat(float in_sensor, float in_min, float in_max, float out_min, float out_max)

{ return (in_sensor – in_min) * (out_max – out_min) / (in_max – in_min) + out_min;}



Lesson Feedback

Contact us

Having trouble? Let us know by completing the form below. We'll do our best to get your issues resolved quickly.

"*" indicates required fields

Name*
Email*
This field is for validation purposes and should be left unchanged.
?