Arduino Basics With Night Light: Step 1: The Board
Arduino Basics With Night Light: Step 1: The Board
by sigritom
LED's
Buttons
Potentiometers
Resistors
Tinkercad
And a project with this knowledge.
The controller can be broken down into a few simple parts. The colours correspond to the image.
The green box provides power to the Arduino and this is plugged in to a USB cable.
The orange provides the power to the bread board either 5v or 3.3v as well as ground.
Arduino Basics With Night Light: Page 1
The red port is a port to power the Arduino without USB at 7-12v.
Purple is a reset button for the microcontroller.
Pale blue is the brains of the operation.
Yellow are the digital pins.
Navy is analog in.
Turquoise is the power LEDs that indicates if there is power.
Finally cyan is TX and RX LEDs They will ash rapidly when you upload a sketch/code.
You don't have to remember all the names but its good have a vague idea of what everything is.
Step 2:
A component is anything that is included in a circuit. This Schematic diagrams use symbols to represent
could be a light, a motor or potatoes! components.
Components have di erent ways of being presented:- In this section I will run through some of the basic
components that will be used in our project at the end.
Realistic illustrations are images or drawings of the
component that look like the component.
Step 3: LED
Step 4: Pushbuttons
Push buttons are switches that will continue the circuit if is another sprigged piece of metal that if pushed down
pressed. The buttons can also be read in your program, will complete the circuit.. This allows electricity to ow
allowing you to start sequences with the push of the through.
button.
How is it detected?
How it works?
When the electricity ows through you can channel it
A push button works by having two pieces of conductive into digital, in which current can be read.
metal apart from each other. In the middle of these there
Step 5: Resistors
Electricity is a type of energy. Like all energy, you can We need resistors, as not all components will run on the
turn it into a di erent type of energy. A resistor works by same current as it will simply be too much.
On a resistor there are lots of di erent colours! Here is a Resistor decoder to help you discover this.
Step 6: Potentiometers
A potentiometer is a component that you can twist to of metal that touches the ring at the point it is facing.
angles you can read.
Finally, the third leg reads the resistance between the
How it works two legs and the knob.
Inside the potentiometer is a circular disk of metal going All of this results in us reading the angle of the knob.
between the front two legs. The middle knob is a piece
A bread board has lots of horizontal strips of wire. When components are put in, they act as connecters.
In the image above you can see that the circuit will only continue when a component is between two strips.
Step 8: Tinkercad!
Tinkercad has a circuit designer on board. Just head over to circuits on the left of your projects.
Once you are in, you can build and create prototypes before making them physically.
Pull out the Arduino and bread board and lay them out on the work plain.
You can colour the wires, but it won't a ect your circuit if you don't.
You then need to wire a 220 ohm resistor to the a push button.
Without the resistor the 5v would be too much for the button and the LED.
The resistor must also be wired to positive, as that has the electricity going to it.
You can change the resistance of the resistor in the top right as shown.
In this step, add an Led to the board rotating it, so that of frying your circuit!
the long leg(anode) is connected to power.
Now we are all done.
You can rotate the LED at the top left corner.
Click on the run simulation and what your LED
Put a wire between the push button and the anode leg illuminate as you press the push button!
and then from cathode to negative(ground)
We are going to create a night light that uses most of what we have learnt so far.
Above is the circuit setup in Tinkercad, as it is easier and more crisp to see the circuit. ↑
The LEDS don't have to be green. I have white and yellow LEDs, so it's like a night light.
Serial is an extension that can print the information that you give or receive so that you know what is happening.
Serial monitor(the extension that prints)can be found in the top right of the Arduino app.
As it is a variable, if you tell the code about the variable at the beginning it will remember it for later.
We still haven't told the code what the variable is. It could be an OUTPUT or an INPUT>
An INPUT is a component that gives data such as a pushbutton(it gives information whether it is being pushed.)
The void setup is where you setup the de nitions of the variables and Serial.
void setup() {
pinMode(LEDY, OUTPUT);
pinMode(LED, OUTPUT);
Serial.begin(9600);
pinMode(pushButton, INPUT);
}
// if its inside {} then it will correspond with the other code inside those {}.
// {} = curly brackets
//LEDY = my yellow LED LED = my white LED
// We have now labelled the LEDs as outputs and push buttons as inputs as well as setup the serial port.
For this project to work we have to know if the button is being pressed. When a button is pressed electricity can pass
through so by understanding this we can read whether there is a current let past (On).
void loop() {
int buttonState = digitalRead(pushButton); // new variable is always what the button is 0/1
// this code turns one light on and the other off according to one of the LEDs state.
// by clicking on the curly bracket you can see where its origins are/ start of the loop.
I hope you enjoyed this Arduino tutorial. If so, please consider voting for me
・。・。・。・。・。・。・。・。・。・。・。・。・・。・。・。・。・。・。・。・。・。・。・。・。
・・。・。・。・。・。・。・。・。・。・。・。・。・・。・。・。・。・。・。・。・。・。・。・。・。
・
https://www.instructables.com/ORIG/FHK/Q46C/KLGLANWA/FHKQ46CKLGLANWA.brd