Arduino Controlled Motor ESC

4 Years ago I made my own drone for a cost of $300 back when the first commercial drone was about $1500. The Arducopter controller controlled the motor ESC, I used the DJI DIY frame, and bought a 720MHZ remote control. Here is a modified KIT of what I built 4 years ago.Ā KIT

Now that I have bit more experience in electronics aerospace engineering, I want to build my own arducopter controller to control the drone. I will be using Arduino for my platform. For today, I will demonstrate that we can control an ESC with and arduino nano.

Materials: Get Most Materials Here
ESC
Motor
Battery that will run the motor
Solder
Solder Iron
Arduino Nano
Bread Board
Jumper Wire
PC
USB Cable
Arduino IDE

Step 1: Solder your Motor to the ESC controller.
Step 2: Attach your Arduino Nano to a bread board.
Step 3: Attach your Battery – to the ESC Black Wire.IMG_20180605_005410
Step 4: Attach your ESC Black to the Arduino GND Pin.
Step 5: Attach your ESC White wire to Arduino D9 Pin.IMG_20180605_005423

Step 6: Attach Arduino Nano to PC with USB Cable.
Step 7: Program Arduino Nano with this Code in Arduino IDE.
Code:
#include ;
Servo esc;
int Pin = 0;
int x = 0;
void setup()
{
esc.attach(9);
}
void loop()
{
int throttle = analogRead(Pin);
throttle = map(throttle, 0, 1023, 0, 179);
for(x = 0; x < 175; x++){
esc.write(x);
delay (250);
}
esc.write(0);
delay(10000);
}
Step 8: Attach your ESC Red wire to Battery +.
Step 9: Enjoy your Arduino Nano commanding the ESC with PWM commands.


Accelerometer Tutorial #2: Basic Earthquake Dectector

Tinee9 is back and today we are going to make a simple Arduino earthquake detector. Please visit my instructable to interface with Tinee9’s LIS2HH12 in the below link to set up the device so all you have to do is add a 3 resistors and 3 Light Emitting Diodes (LEDs)This instructable is considered beginner level with some experience with Arduino software.

*This instructables does not reflect all the possible or correct acceleration changes for earthquakes in the richter scale

Step 1: Earthquakes

Picture of Earthquakes

The picture is a google search capture of an earthquake. As a child, I lived through the 1994 Northridge earthquake. I don’t remember too much about the earthquake other than these things below:

-House was cracked in half and one half now has a step down to it.
-One of the walls in my bedroom had a hole in it to the backyard.
-I lost my favorite toy rattle at the time. It had beads in the rattle that you could see go up and down.
-Sidewalk cement across the street literally flipped upside down.
-The street had a mini “mountain” made out of it.

Needless to say big earthquakes are not fun.

We haven’t had any big earthquakes (Greater than a 5.0) in Southern California for quite a while but one of these days we will. So lets build a Earthquake detector!!!

Ad: Arduino Starter Kit

Step 2: Materials

Picture of Materials

We need:

Click on the pictures below to go the the Amazon page if you need to buy these items for the project. or this link which will put everything in your Amazon kart for you- KIT

-The setup from the LIS2HH12 tutorial

– 3x 690 ohm resistors
-1x Green LED
-1x Yellow LED
-1x Red LED
-Optional: Wire Stripper

Step 3: Quick Lesson on V = I*R

In Electrical Engineering you have the equation V = I * R which invades your life every day.

V = Voltage (Volts, V)
I = Current (Amps,A)
R = Resistance (Ohms)

In a circuit this equation is never violated. So if I connect a 5V source to a 690 Ohm resistor and then to an LED to ground, the current in the circuit is going to be this:

Example LED voltage drop = 2.5V
(Source – LED) = Current * Resistance
5V-2.5V = I * 690 Ohms
I = 2.5V/690 Ohms = 3.62 milliAmps or 3.62 mA

Typical LEDs do not like to exceed 10mA-20mA or they will burn out.

Step 4: LED Polarity

Picture of LED Polarity
Picture of LED Polarity

LEDs have polarity that lets a person know which way it needs to be placed to allow current to flow through it.

Current goes through the Anode of the LED to the Cathode of the LED. It cannot go the other way. If placed backwards it will not work or blow up if voltages exceed its specifications.

If not enough current then there may not be any light emitting from the LED.
The long side on the Red LED is the + Anode and Short side it the – Cathode side.

Step 5: Set Up the Earthquake Dectetor

Picture of Set Up the Earthquake Dectetor
Picture of Set Up the Earthquake Dectetor
Picture of Set Up the Earthquake Dectetor

Steps of setting up the 3x 690 resistors and the 3 LEDs.

1. Place a 690 ohm resistor from D4 (Row 55) of the arduino nano to row 37 of the breadboard

2. Place a Red LED Anode on the top half of the breadboard on row 37 and the Cathode place in the blue rail (GND)

3. Place a 690 ohm resistor from D3 (row 54) of the arduino nano to row 38 of the breadboard

4. Place a Yellow LED Anode on the top half of the breadboard on row 38 and the Cathode place in the blue rail (GND)

5. Place a 690 ohm resistor from D2 (row 53) of the arduino nano to row 39 of the breadboard
6. Place a Green LED Anode on the top half of the breadboard on row 39 and the Cathode place in the blue rail (GND)

7. Make sure none of the wires, resistors, or LED leads are shorted together by accident or you may cause damage to your circuit.

Add TipAsk QuestionCommentDownload

Step 6: Download .Ino

Download the Tiny9_LIS2HH12_Earthquake_mon.ino file from here: github

Step 7: Enjoy

Now you should be able to upload your .ino into your arduino nano.

What will happen is if there is a minor earthquake the Yellow LED will light up.

If there is a major earthquake a Red Led will light up.

Once a minor or major earthquake has been detected you must reset the arduino if you want to turn off the LEDs.

*This sketch does not reflect all the possible or correct acceleration changes for earthquakes in the richter scale.

Accelerometer Tutorial#1: Working with an Accelerometer

Introduction: 3 Axis Accelerometer LIS2HH12 Module

Picture of 3 Axis Accelerometer LIS2HH12 Module

This tutorial is considered beginner level with some experience with arduino software and soldering.

There are at least two purposes of an accelerometer: To determine an angle in particular axes. (X,Y,or Z or all), or to determine acceleration change in an axes.

Accelerometers are used everywhere. They are used in:

Phones, Fitness bands, Drones, Robotics, Missiles, and Helicopters just to name a few. How you want to use an accelerometer is up to a person’s imagination.

Step 1: Materials

Picture of Materials

Materials you need are:

Arduino Nano or preferred arduino device

USB to Arduino Cable

LIS2HH12 Module,(Amazon link on the picture)

Wire Strippers and Wire, or Point to point Breadboard Jumpers

2x 10 Kohm resistors
https://kit.com/embed?url=https%3A%2F%2Fkit.com%2FTinee9%2Ftinee9-basic-arduino-kit

Step 2: The Sesnor

Picture of The Sesnor
Picture of The Sesnor

LIS2HH12 module is based off the ST 3-Axis accerlerometer. The module is a tiny package and allows for 2 5-pin headers to be soldered to it. This mitigates vibration noise that is introduced to the accelerometer. from external sources of varying frequencies.

Main features for this chip are:
-Low-power mode 5uA draw
-16-bit resolution
-Performs +/-2 g,4 g,8 g
-0.2% noise
-I2C or SPI protocol
-Typical Voltage
-3.3V

Max Rating 4.8V (Do not go above 4.8 volts or you will break the Accelerometer chip)

Step 3: Project Platform

Picture of Project Platform

Project Platform for the accelerometer is Arduino.

The Development board I am using is a Arduino Nano.

Currently the Tinee9 LIS2HH12 accelerometer has only basic code for the Arduino but will be hopefully expanding the code for more technical projects and for Raspberry Pi or any platform that has enough fan base recommended by YOU. šŸ™‚

Step 4: Breadboard

Picture of Breadboard

If you have headers on both of your Arduino nano and LIS2HH12 Module you can put the Arduino Nano and accelerometer on the Breadboard like this, straddling the split line allowing access to the breakout pins.

Make sure the 3.3V pins on the Module is facing the Arduino.

If you do not have header on them get some and solder them to the boards.

Step 5: Placing Resistors on the Board

Picture of Placing Resistors on the Board

The I2C protocol that we will be using in this project needs 2 10 Kohm pull-up resistors to the supply rail on the chip (+3.3 Pins); one on the Clock line (CL) and one on the Data Line (DA)

Since the LIS2HH12 accelerometer max voltage is 4.8V and in this project we are using the 5V off of the Nano, I have placed a 100 ohm resistor from the 5V pin on the Nano to the red supply rail on the breadboard to bring down the supply rail a little.

Step 6: Connecting the Rest of the Board

Picture of Connecting the Rest of the Board

Now we are going to connect the rest of the module to the arduino.

The Gnd Pin on the module and arduino should have a jumper wires going from it to the Blue Rail on the Breadboard.

Connect the +3.3 Pin on the module to the red supply rail on the breadboard.

These last two step allowed us to power up the module when we power the arduino via battery or USB

Jumper Wire from the +3.3 Pin on the Module to the CS pin on the moduleĀ (This enables the I2C bus on the module)

Jumper wire from the Gnd Pin on the module to the A0 pin on the moduleĀ (This tells the accelerometer which address it will respond to when talking on the I2C Bus)

Jumper wire from A5 on the arduino to CL on the ModuleĀ (This allows the clock on the arduino to sync with the acceleromter.

Jumper wire from A4 on the arduino to DA on the moduleĀ (This allows the data to be transferred between the arduino and the module.)

Step 7: Download Files

Picture of Download Files

Go to Github addressĀ https://github.com/Tinee9/LIS2HH12TRĀ and download the files.

Go to this location on your computer

C:\Program Files (x86)\Arduino\libraries

Create a Folder Called Tiny9

Place the .h and .cpp Files in that Tiny9 Folder

Step 8: Open Up .ino

Picture of Open Up .ino

Open up the .ino file you downloaded in the Arduino IDE (Program/software)

Step 9: Upload Sketch

Picture of Upload Sketch

Once you have connected your arduino via USB cable to the computer, there should be a port number highlighted under tools tab in the arduino IDE.

My port happens to be COM 4 but yours might be 1 or 9 or something else.

If you have multiple COM options then choose the one that represents the Arduino that you are using. (How to determine which COM port for multiple choices can be on a different instructable if requested.)

Once you have the Arduino Port chosen, click the upload button.

Step 10: Enjoy

Picture of Enjoy

After it has finished Uploading you should be able to open the Serial Monitor in the Tool Tab and you should see something like this popping on your Monitor.

The Graph displays the x,y, and z axis in that order.

Z axis should say close to 1.0 +/- some counts because Z is pointing up.

Now you can rotate your breadboard and enjoy watching the numbers change showing you how the module’s axises are affected by gravity and acceleration.

 

Accelerometer Tutorial #1: Working with an Accelerometer

Introduction: 3 Axis Accelerometer LIS2HH12 Module

Picture of 3 Axis Accelerometer LIS2HH12 Module

This tutorial is considered beginner level with some experience with arduino software and soldering.

What does an accelerometer do?

There are at least two purposes of an accelerometer: To determine an angle in particular axes. (X,Y,or Z or all), or to determine acceleration change in an axes.

Accelerometers are used everywhere. They are used in:

Phones, Fitness bands, Drones, Robotics, Missiles, and Helicopters just to name a few. How you want to use an accelerometer is up to your imagination.

Step 1: Materials

Picture of Materials

Materials you need are:

Arduino Nano or preferred arduino device

USB to Arduino Nano Cable

Wire Strippers and Wire, or Point to point Breadboard Jumpers

LIS2HH12 Module,(Amazon link on the picture)

2x 10 Kohm resistors

You can click on the amazon links below if you need an individual item or you can click the for the full kit hereĀ Ā KIT

ļ»æ

Step 2: The Sensor

Picture of The SesnorPicture of The Sesnor

LIS2HH12 module is based off the ST 3-Axis accerlerometer. The module is a tiny package and allows for 2 5-pin headers to be soldered to it. This mitigates vibration noise that is introduced to the accelerometer from external sources of varying frequencies.

Main features for this chip are:
-Low-power mode 5uA draw
-16-bit resolution
-Performs +/-2 g,4 g,8 g
-0.2% noise
-I2C or SPI protocol
-Typical Voltage
-3.3V

Max Rating 4.8V (Do not go above 4.8 volts or you will break the Accelerometer chip)

Step 3: Project Platform

Picture of Project Platform

Project platform for the accelerometer is Arduino.

The development board I am using is a Arduino Nano.

Currently the Tinee9 LIS2HH12 accelerometer has only basic code for the Arduino but will be hopefully expanding the code for more technical projects and for Raspberry Pi or any platform that has enough fan base recommended by YOU. šŸ™‚

Step 4: Breadboard

Picture of Breadboard

If you have headers on both of your Arduino nano and LIS2HH12 Module you can put the Arduino Nano and accelerometer on the Breadboard like this, straddling the split line allowing access to the breakout pins.

Make sure the 3.3V pins on the Module is facing the Arduino.

If you do not have header on them get some and solder them to the boards.

Step 5: Placing Resistors on the Board

Picture of Placing Resistors on the Board

The I2C protocol that we will be using in this project needs 2 10 Kohm pull-up resistors to the supply rail on the chip (+3.3 Pins); one on the Clock line (CL) and one on the Data Line (DA)

Since the LIS2HH12 accelerometer max voltage is 4.8V and in this project we are using the 5V off of the Nano, I have placed a 100 ohm resistor from the 5V pin on the Nano to the red supply rail on the breadboard to bring down the supply rail a little.

Step 6: Connecting the Rest of the Board

Picture of Connecting the Rest of the Board

Now we are going to connect the rest of the module to the arduino.

The Gnd Pin on the module and arduino should have a jumper wires going from it to the Blue Rail on the Breadboard.

Connect the +3.3 Pin on the module to the red supply rail on the breadboard.

These last two step allowed us to power up the module when we power the arduino via battery or USB

Jumper Wire from the +3.3 Pin on the Module to the CS pin on the moduleĀ (This enables the I2C bus on the module)

Jumper wire from the Gnd Pin on the module to the A0 pin on the moduleĀ (This tells the accelerometer which address it will respond to when talking on the I2C Bus)

Jumper wire from A5 on the arduino to CL on the ModuleĀ (This allows the clock on the arduino to sync with the acceleromter.

Jumper wire from A4 on the arduino to DA on the moduleĀ (This allows the data to be transferred between the arduino and the module.)

Step 7: Download Files

Picture of Download Files

Go to Github addressĀ https://github.com/Tinee9/LIS2HH12TRĀ and download the files.

Go to this location on your computer

C:Program Files (x86)Arduinolibraries

Create a Folder Called Tiny9

Place the .h and .cpp Files in that Tiny9 Folder

Step 8: Open Up .ino

Picture of Open Up .ino

Open up the .ino file you downloaded in the Arduino IDE (Program/software)

Step 9: Upload Sketch

Picture of Upload Sketch

Once you have connected your arduino via USB cable to the computer, there should be a port number highlighted under tools tab in the arduino IDE.

My port happens to be COM 4 but yours might be 1 or 9 or something else.

If you have multiple COM options then choose the one that represents the Arduino that you are using. (How to determine which COM port for multiple choices can be on a different instructable if requested.)

Once you have the Arduino Port chosen, click the upload button.

Step 10: Enjoy

Picture of Enjoy

After it has finished Uploading you should be able to open the Serial Monitor in the Tool Tab and you should see something like this popping on your Monitor.

The Graph displays the x,y, and z axis in that order.

Z axis should say close to 1.0 +/- some counts because Z is pointing up.

Now you can rotate your breadboard and enjoy watching the numbers change showing you how the module’s axises are affected by gravity and acceleration.