Sensors and variable resistors In the last chapter, we learned how to put buttons into a circuit to play notes through a speaker and to turn an LED on and off. Now we’re going to learn how to attach sensors to a circuit and use the information we gather from them to create more subtle […]

Read More →

Step by step potentiometer LED circuit The first circuit we will build will contain a potentiometer that will control the brightness of an LED. You’ll need these parts: 1 LED 1 220 Ohm resistor (red, red, brown, gold) 1 10K Ohm potentiometer Jumper wires Breadboard Arduino Uno USB A-B cable Computer with Arduino IDE We […]

Read More →

What Role Does the Sketch Play in Our Circuit? You’ve seen the circuit in action, so you understand what it does, but how does the Arduino translate the potentiometer’s resistance value to a brightness value for the LED? To figure that out, let’s take a look at how electricity and information flow through our circuit. […]

Read More →

ATG6_AnalogSerial sketch This Arduino sketch reads the value of voltage on pin A0, translates it to a value the LED can understand, and then sends it out to pin 9. As is other sketches we have seen, there is an initialization section, a setup() function, and a loop() function. Here’s a screenshot of the sketch. […]

Read More →

Analog input: values from the potentiometer The first line of code has the Arduino check the value of voltage coming in from the potentiometer on pin A0. This value is stored in sensorValue. How is the changing resistance of the potentiometer affecting the values coming out of pin A0? If we were to use a […]

Read More →

Analog values as output: PWM As we have seen in earlier chapters, the Arduino is only capable of putting out a few different voltage values: either 5V or 3.3V. All of the I/O pins on the Arduino are set to output 5V when used to control circuit components. If the Arduino is only capable of […]

Read More →

Using the Serial monitor The serial monitor is a feature of the Arduino IDE that shows us information sent from the Arduino. It is helpful for de-bugging and for learning what values a sensor or variable resistor produces. To open the Serial Monitor, click the button at the top of the Arduino IDE. When we […]

Read More →

Adding the speaker We’re going to keep all the components that are currently in our circuit and add a speaker. Both the LED and the speaker will use the values produced by turning the potentiometer to control their behavior. Part to add 1 speaker Connect one end of the speaker to pin 11, the other […]

Read More →

Adding the photocell step by step Place the photocell in the breadboard so that one end is in the same row of tie points as the jumper from analog pin A0. The other end should be in the row of tie points below that. The photocell doesn’t have an orientation so don’t worry about placing […]

Read More →