Arduino Home

An Open-Source platform to create digital devices and interactive objects that sense and control physical devices.

Arduino Tutorials
Arduino Projects

 

Arduino Starter Kit Competition INDEX:

 

Element14's Arduino Starter Kit Competition

Element14's Arduino Starter Kit Competition - Part 1

Element14's Arduino Starter Kit Competition - Part 2

Element14's Arduino Starter Kit Competition - Part 3

Element14's Arduino Starter Kit Competition - Part 4

Element14's Arduino Starter Kit Competition - Part 5 (motor fun)

Element14's Arduino Starter Kit Competition - Part 6

Element14's Arduino Starter Kit Competition - Part 7

Element14's Arduino Starter Kit Competition - Final Part and Conclusions

 

Project Book - 04 Colour Mixing Lamp

 

Moving on through the Project Book in the Arduino Starter Kit I get to project No. 4....

"Using a tri-colour LED and three photoresistors you'll create a lamp that smoothly changes colours depending on external lighting conditions."

- sounds like my kind of project !

 

After building the circuit up and entering the sketch I compiled (correcting the typo I managed) and then uploaded the sketch. The LED illuminated an off white colour. Covering up various PhotoResistors or turning the room lights off had little effect. I looked at the  Serial Monitor output which was horizontally scrolling data. I checked the Project Book again and found I had omitted the PrintLn values instead using Print. After correcting them I found that the blue channel still didn't seem to change. I commented out the lines that echoed the actual values so I could concentrate on the raw data. Taking each of the Arduino's analog pins high/low made the channel values change between 1023 and 0 respectively for A0 and A1 but for A2 (the blue channel) this didn't have the same effect (this is where the Serial Monitor become invaluable); I looked back at the code and found I'd typed the line incorrectly - see below.

  redSensorValue=analogRead(redSensorPin);

  delay(5);

  greenSensorValue=analogRead(greenSensorPin);

  delay(5);

  blueSensorValue=analogRead(blueSensorValue);

I corrected that line and restored the echo to show all data. The board now started to work as expected in the write up. Turning the room light off made the colours fade then to blue and off. I couldn't get the LED to show much green but I guess modern LED lighting is more biased to red/blue perhaps?

photo_2017-08-20_21-16-12.jpg

 

Summary of Project 04 - This was one of the more awkward projects so far, the Light Dependent Resistor (LDR) had thin wires which bent easily rather than locate into the breadboard (a pair of fine pliers might help), the clips to hold the gel filters seemed incorrectly sized and I opted for a few pieces of sticky tape instead. I found the term AnalogRead used in previous projects made sense but the term AnalogWrite for outputting a Pulse Width Modulation (PWM) signal was a little contradictory. However, the term is still a nice easy and neat way to implement PWM in code. I think the project shows some interesting concepts (PWM, scaling of values). Also because the circuit didn't work the first time I got to try out some fault finding and code debugging

 

I think there is a lot of possibility for this circuit and I will look forward to coming back to this project and perhaps trying out some different scaling/auto fading ?

Board Mount Update

At this point I've addressed the issue of mounting the Arduino on the baseboard. I had to leave the machine screws loose otherwise the three mounting points and solder legs on the bottom of the board caused the board to deform. However, leaving the machine screws loose was annoying me slightly. I've just rummaged in my nuts & bolts draw and found some nylon washers. I've packed between the baseboard and the Uno with 3x washers per machine screw. I've then put another under the fixing nut - for good measure/insulation.

 

 

Project Book - 05 Mood Cue

Mmm, next project in the book is - a servo project; how cool; once I've mastered this I can remotely operate all sorts of things....

 

I now get to look inside one of the kit's other boxes....

IMG_20170821_124537177.jpg

I built up the circuit as shown in the project book. I had a slight issue with the diagram and wiring not being the same as the pre-terminated servo header. More of an issue was that the header strip was too short on one side and would neither connect into the breadboard nor the servo header. I opted for some wire links instead.

IMG_20170821_124813260.jpg

 

I then did some artwork - ps: Jim, if you are reading this and get more than your normal amount of questions at work, I'm sorry.

 

IMG_20170821_141145220.jpg

The Arduino sketch as entered by me (I meant to add some comments along the lines of good programming practice):

#include <Servo.h>

 

Servo myServo;

 

int const potPin=A0;

int potVal;

int angle;

 

void setup() {

  // put your setup code here, to run once:

  myServo.attach(9);

  Serial.begin(9600); 

}

 

void loop() {

  // put your main code here, to run repeatedly:

  potVal=analogRead(potPin);

  Serial.print("potVal: ");

  Serial.print(potVal);

 

  angle=map(potVal,0,1023,0,179);

  Serial.print(", angle: ");

  Serial.println(angle);

 

  myServo.write(angle);

  delay(15);

}

I had a compile error after typing in #include <servo.h> rather than #include <Servo.h>

 

The circuit operated well and I particularly liked the built in function to map one range across to another rather than having to scale them using mathematics directly.

 

Summary of Project 05 - getting the servo to follow the potentiometer input was so simple with the built in library. I would imagine it would quickly inspire users to build something themselves rather than get bogged down in the underlying technical detail and perhaps giving up. Coupled with the previous project themes anyone using this kit would already be able to PWM LEDs, control a servo, read a temperature sensor, read switches (and use the Serial Monitor). I also think that the speed of turning ideas into reality with the Arduino, both drawing on the large online community and those Open Source libraries, is one of the key features.

 

[Up next in the Arduino Project Book is "Light Thermin" - some sort of noise generating circuit.....]