I thought an Arduino was something you southerners drank while you sat around on the porch eating raspberry pie.
–Gordy Sabine
Arduino Nano Battery Tester: Soldering Timelapse
This is a continuation of the previous project video “How To Build A Battery Tester” https://goo.gl/4k612V where we take an Arduino Nano and a few other electronic parts to build a AA battery tester that will give us fairly accurate “real world” readings on NiMH batteries. This little device will come in handy for the next project on the list, so be sure to subscribe for more how-tos!
Do you have some rechargeable batteries lying around that need a capacity check? Let’s put together an Arduino-powered Battery Tester so we can verify the listed capacity of these cells!
Parts and Tools (affiliate links):
Helping hands: http://amzn.to/2vkDUyY
Soldering iron/station: http://amzn.to/2vkzqbH
Lead-free solder: http://amzn.to/2fuuawR
16 AWG Speaker wire: http://amzn.to/2vniSyh
AA battery holder: http://amzn.to/2eHNEOa
Terminal blocks: http://amzn.to/2uq1IRD
1R10W Ceramic Resistor: http://amzn.to/2eHKk5H
Arduino Nano (clone): http://amzn.to/2uQAd4Z
1.5R10W Power Resistor: http://amzn.to/2eIieHc
IRF3205 MOSFET: http://amzn.to/2eInMBG
10KR Resistor: http://amzn.to/2uPLjXQ
Nokia 5110 Screen: http://amzn.to/2eHS0VC
–Be sure to subscribe! https://goo.gl/j3ATwZ
–Follow on Twitter http://twitter.com/airbornesurfer
–LIVE every Thu @ 5pm Pacific
–Everything else is at http://airbornesurfer.com
Tech teardowns, repairs, and reviews; sketches; how-to; games; and lots of other interesting geekery. At least one new video per month! Thanks for watching, and be sure to like, share, and subscribe!
How To Use LSM9DS1 With Arduino
The LSM9DS1 is a 9-degree-of-freedom accelerometer, gyroscope, and magnetometer module that can add motion-sensing capabilities to any Arduino project. In this video, I will show you how to use the LSM9DS1 with Arduino IDE including how to set up the LSM9DS1 libraries in Arduino.
How To Build An Arduino Joystick Mouse
In this video, we’ll use the Arduino Leonardo-compatible Adafruit ATmega32u4 Featherboard to build a joystick-style mouse that can be used with any USB-equipped computer. This will be built into Project Xyberpunk to replace the Trackpoint-style mouse module in the original design.
Watch the complete Project Xyberpunk series at element14.com
Arduino Basics Lesson 1-1: “Hello, World!”
For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.
“Hello, World!” is the most basic “program” developers use to test their understanding of a piece of hardware or programming language. On the Arduino, the “blink” sketch stands as the most basic bit of code that will run with human-readable output.
Let’s get our feet wet with the Arduino platform by assembling a slightly more complex version of “blink” using an external LED.
The Circuit:
Connect a jumper wire from pin 2 to the anode of the LED. The anode is the “+” side of the LED and has a longer leg. The easy way to remember this is that the extra little bit of lead can be clipped off to make a plus sign on the leg.
Connect a 220R resistor to the cathode of the LED. We’re using a 220R resistor because it will allow the most voltage to come through while reducing the overall current. I’ll explain how this works in a future video.
Connect the resistor back to the ground pin of the Arduino with another jumper.
The Sketch:
/*
"Hello World" Blink Sketch
Turns an LED on for one second, then off for one second, repeatedly.
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
modified 3 Aug 2019
by Matthew Eargle
This example code is in the public domain.
*/
int ledPin = 2; //Define ledPin as integer variable with value of 2
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin ledpin as an output.
pinMode(ledPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Can you determine what the Arduino is doing at each line in the code?
What happens if we change the values of some variables?
What happens if we change the time parameter of the delay?
How To Build An Arduino-Controlled LED Matrix
If you need more blinkenlights than Pin 13 can provide on its own, it’s time to build an LED matrix to make the most of the few pins that you have! In this video, we’ll take a look at a simple transistor-based LED matrix and how it can be driven by an Arduino Nano. It’s all part of Project Hawthorne for element14 Presents!
Arduino Basics Lesson 1-2: “Input!”
For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.
In the previous lesson, we learned how to have an Arduino “talk” to us by blinking an LED. Now, we’re going to send signals to the Arduino by pressing a button. After completing this lesson, you should be able to attach any digital sensor to the Arduino and get some usable result.
To verify that the Arduino is receiving our signals properly, we’re going to use those signals to trigger an LED and a message in the serial monitor.
The Circuit:
Connect a jumper wire from the +5V pin to one side of the tactile switch. The adjacent (unswitched) leg of the switch is connected to the anode (+) of the LED. A 330R resistor provides over-current protection for the LED and is connected from the cathode to ground.
The switched side of the tactile switch connects with a jumper wire to pin 2 on the Arduino.
Connect the resistor back to the ground pin of the Arduino with another jumper.
The Sketch:
/*
Input!
Reads a digital input on pin 2, lights an LED, and prints the result to the Serial Monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int buttonState = digitalRead(pushButton);
// print out the state of the button:
Serial.println(buttonState);
delay(1); // delay in between reads for stability
}
Arduino Basics Lesson 1-3: “Analog Input!”
For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.
In the previous lesson, we learned how to use a button to create a simple digital input on the Arduino. We also learned how to use the serial monitor to display the button state. In this lesson, we’re going to use a potentiometer to create an analog input and read it on the serial monitor.
The Circuit:
Connect a jumper wire from the +5V pin to pin 1 (the left pin, input, if you’re looking down the shaft) of a 10k potentiometer. Connect a second jumper wire from pin 2 (the right pin, ground) to the ground pin on the Arduino. Connect a third jumper from pin 3 (center pin, signal) to A0 on the Arduino.
The Sketch:
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
Now, with just a few more lines of code, you can determine the actual voltage going through the potentiometer and into the Arduino:
/*
ReadAnalogVoltage
Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}
Arduino Basics Lesson 1-4: “These Peoples Try To Fade Me!”
For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.
So far, in this series, we have learned to read and write digital information with an Arduino. We have also learned to read analog information with the Arduino and a potentiometer. In this video, we will learn how to send pseudo-analog signals from the Arduino to a device by fading the light on an LED.
The Circuit:
Connect a jumper wire from pin 9 on the Arduino (9 is an analog out pin as denoted by the tilde [~] sign) to a 220R resistor. Connect the other end of the resistor to the anode of an LED. Connect the cathode of the LED to the ground pin of the Arduino using another jumper wire.
The Sketch:
/*
Fade
This example shows how to fade an LED on pin 9 using the analogWrite()
function.
The analogWrite() function uses PWM, so if you want to change the pin you're
using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
This example code is in the public domain.
*/
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
What happens if we change the delay attribute?
What happens if we change the value of the fadeAmount
variable?
As a challenge, see if you can figure out how to use a potentiometer to control the fade effect–either through the rate of the fade or the brightness.
Arduino Basics Lesson 2-1: “Play It Again, Sam”
For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.
Up until this point in the series, we have been using LEDs to manipulate light with the Arduino. For this project, we’re going to incorporate a piezo buzzer to manipulate sound for Maximum Annoyance Value! The piezo is a small element that vibrates in the presence of an electric current or–alternatively–generates an electric current when it vibrates.
The Circuit:
Connect jumper wires from the +5V and GND pins on the Arduino to the bus rails along one side of the breadboard. Connect a jumper from the +5V rail to one side of a tactile switch. Connect the other side of the switch with a jumper to one side of the next switch, and so on, until you have wired all 4 switches in series. Connect a jumper from the last switch terminal to pin A0 on the Arduino.
Connect the 220R, 1KR, and 1MR resistors to the switches as shown in the diagram.
Connect the ground lead of the piezo buzzer to the ground rail and the positive lead to pin 8 on the Arduino via jumper wires.
The Sketch:
/*
Play It Again, Sam
A rudimentary Arduino synthesizer
created 13 Sep 2012
by Scott Fitzgerald
This example code is part of the public domain.
*/
// create an array of notes
// the numbers below correspond to the frequencies of middle C, D, E, and F
int notes[] = {262, 294, 330, 349};
void setup() {
//start serial communication
Serial.begin(9600);
}
void loop() {
// create a local variable to hold the input on pin A0
int keyVal = analogRead(A0);
// send the value from A0 to the Serial Monitor
Serial.println(keyVal);
// play the note corresponding to each value on A0
if (keyVal == 1023) {
// play the first frequency in the array on pin 8
tone(8, notes[0]);
} else if (keyVal >= 990 && keyVal <= 1010) { // play the second frequency in the array on pin 8 tone(8, notes[1]); } else if (keyVal >= 505 && keyVal <= 515) { // play the third frequency in the array on pin 8 tone(8, notes[2]); } else if (keyVal >= 5 && keyVal <= 10) {
// play the fourth frequency in the array on pin 8
tone(8, notes[3]);
} else {
// if the value is out of range, play no tone
noTone(8);
}
}