SLD Projects

Introduction

The SLD Arduino Project education approach is comprised of multiple aspects. The Elegoo “lessons” training material is our starting point to which we are adding our own training content to elaborate an the details and providing links to further useful internet information.

We will also be delivering our own exercises (projects) to enhance the learning process. These projects will provide the opportunity to implement what we have learned and to experiment further. This page will capture the details regarding these projects.

Project 1

This Project is tailored to be performed after completing Elegoo Lesson 4.

This multi-step exercise is described in this document – Arduino Oct Kit Busters 2022-10-30 Final (pdf file).

The objective is to assemble an LED circuit then create the code to manage the LED.
The additional LEDs are introduced with further evolution of the software to control these LEDs and to adjust their behaviour.

The following table identifies each exercise, pointers regarding what needs to be performed and a link to the example sketch. You will need to copy/paste the sketch into your IDE then it can be uploaded to the Arduino board and run.

Exercise Description Exercise Scope Sketch Example
Flash a single LED Create Sketch
Open IDE
Select “new”
– Save as new Sketch, i.e.
– Project_1_-_Part_1_Single_LED_Blink
Add description comment regarding purpose of sketch
Void Setup
– Initialize pin(s)
Void Loop
– Copy Lesson 2 code
– Change to pin 5
Upload to Arduino
Project_1_-_Part_1_Single_LED_Blink (ino file)
Two LEDs flash together Create Sketch
Re-Save previous Sketch
Update description comment regarding purpose of sketch
Void Setup
– Add initialize pin 4
Void Loop
– Expand to include pin 4
Upload to Arduino
Project_1_-_Part_2A_Two_LED_Blink (ino file)
Two LEDs alternating flash Create Sketch
Re-Save Sketch 2A
Update description comment regarding purpose of sketch
Void Setup
– No changes required
Void Loop
– Reverse On/Off status for pin 5
Upload to Arduino
Project_1_-_Part_2B_Two_LED_Blink (ino file)
Four LEDs flash together Create Sketch
Re-Save Sketch 2A
Update description comment regarding purpose of sketch
Void Setup
– Add initialize pins 2 & 3
Void Loop
– Expand to include pins 2 & 3
Upload to Arduino
Project_1_-_Part_3A_Four_LED_Blink (ino file)
Four LEDs flashing in sequence Create Sketch
Re-Save Sketch 3A
Update description comment regarding purpose of sketch
Void Setup
– No changes required
Void Loop
– Insert 0.5 second delay after each write
Upload to Arduino
Project_1_-_Part_3B_Four_LED_Blink_Sequence (ino file)
Adjust four LEDs flashing in sequence Create Sketch
Re-Save Sketch 3B
Update description comment regarding purpose of sketch
Void Setup
– No changes required
Void Loop
– Change delay length after each write
Upload to Arduino
Project_1_-Project_1_-_Part_3C_Four_LED_Blink_Sequence (ino file)
Adjust LEDs to flash on/off in sequence Create Sketch
Re-Save Sketch 3c
Update description comment regarding purpose of sketch
Void Setup
– No changes required
Void Loop
– Change sequence of write & delay statements
Upload to Arduino
Project_1_-_Part_4A_Four_LED_Blink_Sequence (ino file)

Project 2 – Traffic Lights

To further expand upon what we have covered to this point and to demonstrate how you can build something with this that can be deployed on your model railroad, Ron has designed this Traffic Light system.

The pdf document describes the physical implementation along with how to approach the code design based on the desired behaviour of the system. An explanation of the code is included along with a link to the example code.

Traffic Light Instructions: Traffic Light Exercise (pdf file).

Traffic Lights Sketch: TrafficLightsRev1 (ino file).

Project 3 – Servos

The Elegoo Lesson 9 just touches the surface pertaining to controlling servos
Here are three more exercises you can explore to better understand how Arduinos manage servos.

Here is the tutorial: Arduino Server Control tutorial (pdf file).

and here are the three sketches:
Project 3-1 Servo Sketch Basic: Servo Sketch Basic (ino file).

Project 3-2 Servo Sketch with 0-180 Adjustment: Servo Sketch with 0-180 Adjustment (ino file).

Project 3-3 Sketch with Pot: Servo Sketch with Potentiometer (ino file).

Project 4 – Servos Part 2

In addition to the Elegoo Lesson and the additional tutorial, Ron has assembled three more servo exercises for us that delve into that target a model raiload type servo implementations.

Here is Ron’s instructions that cover the physical implementation in detail along with a line by line discussion regarding the Arduino code. Ron identified the third one was interesting to figure out, I didn’t want to make it too complicated but wanted to show that you don’t need a lot of code to accomplish something.

Controling Turnouts With Servos Exercise (pdf file).

and here are the three sketches:
Servo 2 Button: Servo Sketch with 2 Buttons (ino file).

Servo 2 Button with LED: Servo Sketch 2 Button with LED (ino file).

Servo 1 Button with LED: Servo Sketch 1 Button with LEDs (ino file).

Project 5 – Warehouse Door

At this point in the program after completing up to Elegoo Lesson 13, we felt knowledgeable enough to undertake our own project from scratch. The core objective is to understand how to incorporate multiple functions in the same sketch and how to facilitate multiple things happening concurrently. Since the Arduino is a single thread processor, this must be managed through proper code architecture.

We chose to automate a factory door as this would involve using buttons, LEDs, a servo and buzzer.

Here is the presentation deck that describes the approach, schematic and sketches. Arduino Jan Kit Busters (pdf file).

Though the hardware was implemented in it’s entirety, we chose to deliver the functionality is three software increments.
The first sketch contained the core functionality to read the push buttons, to rotate the servo and to show the door status (Open/close) via the green/red LEDs.
Here is the sketch and code review.
Step 1 Sketch: Step 1 Sketch – 2 Buttons with servo (ino file).
Step 1 Code Review: Step 1 Sketch – 2 Buttons with servo Code Review (pdf file).

The second step involved adding the Flashing LED to the sketch. Refer to the Presentation Deck for the approach we took to manage the servo rotation and blinking the red LEDs at the same time.
Here is the sketch and code review.
Step 2 Sketch: Step 2 Sketch – 2 Buttons with servo/LEDs (ino file).
Step 2 Code Review: Step 2 Sketch – 2 Buttons with servo/LEDs Code Review (pdf file).

The third step involved adding the buzzer to the sketch. Refer to the Presentation Deck for the approach we took to manage the servo rotation, blinking the red LED and sounding the buzzer at the same time.
Here is the sketch and code review.
Step 3 Sketch: Step 3 Sketch – 2 Buttons with servo/LEDs/Buzzer (ino file).
Step 3 Code Review: Step 3 Sketch – 2 Buttons with servo/LEDs/Buzzer Code Review (pdf file).