Inspirational picture of the design
The main objective of the assignment was to develop creating electrical circuit design with more complex code & extra functionality that provide more accuracy.
I decided to create simple color gradient measurement that shows warm to cold hue depends on positioning.
I- Electronic:
Software:
Thinkercad (to make sure the circuit if functional).
Arduino IDE (to load programming code to the arduino).
Material:
Arduino Uno.
7RGB LED.
220-ohm resistor.
Ultrasonic sensor.
Push button.
Servo motor
Breadboard & crocodile wires.
Power adaptor, Rosetta & USB cable.
Softwares & materials used
I-Circuit (Thinkercad)
Step (1): I started creating the circuit by place & connect Arduino & breadboard together.
Step (2): Then I added Ultrasonic sensor to the bread board & linked it to the Arduino.
Step (3): Then, I added RGB LED with separate resistors for each pin & connected it to the Arduino.
Step (4): After that, I added servo motor & connect the Arduino.
Step (3): After that I added push button that would control servo motor & connected it to the Arduino.
II-Code
Step (1): I started by calling servo motor function.
Step (2): Then, I sat colors mode depends on ultrasonic distance readings (ex: from 60 to 70 it creates blue light).
Step (3): I created mapped angle to change range of color from 0:100 to be 0:180 which is servo motor range.
Step (4): I created functions for each color by changing RGB values to create different colors.
III-Simulation (Tinkercad)
I-Circuit (Building Components)
It was easy step to build the circuit as it was designed.
II-Circuit (Testing Components)
Testing ultrasonic reading, it was perfect.
Testing servo motor motion with different reads.
III-Circuit (Full Circuit)
It's time for testing colors effect on both motion & light.
The problem that bugged me the most was the RGB LED calibration, as I wanted to provide a wide range of colors from warm to cool but I wanted it also to show the exact needed color not any unexpected hues, that's why I had to test many hues specially for secondary colors to achieve colors I like to have for testing out of different values & combination.
I would say that it was the huge coding week as, it was full of practice on coding the Arduino on different techniques, that made me more & more familiar with writing & understanding the code to be able to create what I needs in my project.
Well, I guess the most interesting thing that I learned this week was how to create more than mood for one device and how switch from manual to automatic mode Also, the concept of serial monitor that helped a lot to understood how it works.