Angle measurement using gyro, accelerometer and Arduino

Friday, 26 July 2013
DSC05259.JPG

The device is a rough prototype of what will eventually become a self balance robot, this is the second part of the hole thing (read accelerometer and control a motor to self balance). The first part with only the gyro can be found here.
On this instructable we will measure the angle using both gyro and accelerometer, and using a technique to merge both sensor to get a smooth signal. The technique is called "complementary filter".

previous

Step 1: What we gonna need:

Some part can be replace, and some modification at the code have to be made to fit your hardware.
On this project we will use:
- Breadboard
- Microcontroller, I used the Arduinoboard
- Wire
- Jumper Wires
- Gyroscope XV-8100
- Nunchuck Wii (for the accelerometer)
- Nunchuck Wii adapter for Arduino

Step 2: Building...

The circuit consists of a gyroscope connected direct to port 0 at your arduino and a nunchuck wii connect at the I2C port.

Assembling the gyro:

1. - plug the gyro at the breadboard
2. - wire ever thing:
- Vo pin from gyro connected to analog port0 at arduino (Light orange wire)
- G pin from gyro connected to ground (White wire)
- V+ pin from gyro connected to Vdd(3.3V) (Orange wire)

Assembling the accelerometer:

1. - plug the adapter at the nunchuck
2. - plug the nunchuck at the arduino using the adapter
3. - place the accel sensor like the photo above

Step 3: Some extra information before we proceed

From both sensor we can measure the angle but using two distinct technique.

To measure the angle using the gyro we have to integrate the signal.
But why we have to do this?
Because the gyro give us the angular rate, so a simple way to get the angle is have the angular rate multiplied by the time [angle = angle + w * dt]

To measure the angle using an accelerometer we have to sense the gravity in each axis of the accelerometer, what it means, the projection of the gravity acceleration on each direction of the sensor give us an idea about the angle. [angle_accel = arctg( Ay / sqrt( Ax^2 + Az^2 ) )]

So why we gonna use two sensor instead one?
To take the advantage of both sensor properties. If you look at the graphic the gyro data continuous increase, this is called drift and the accelerometer data change a lot at a small time.

And how to merge both signal?
We will use a technique called complementary filter. I don't know the exact theory behind this, but it works fine. There are some information at the internet, just google it if you need more information. This link has a lot of information and can be useful.

filtered_angle = HPF*( filtered_angle + w* dt) + LPF*(angle_accel); where HPF + LPF = 1

The values of HPF and LPF can be found at this link, on the filter.pdf file. Thanks you guys from "The DIY Segway".
Just for test purpose we gonna set this values like this, HPF = 0.98 and LPF = 0.02.

Step 4: Code:

The code is a adaptation from a code that I used on another project. Probably there are some variables unused.
I used a library to read the nunchuck data from http://todbot.com/blog/. Thank you Tod E. Kurt.
The comments on code are in portuguese, as soon as I have a free time, I will translate it.

The code output trough the serial line some numbers with this pattern:

dt : w : teta : pitch : filter_teta $
time:angular_velocity:gyro_angle:accel_angle:filtered_angle$

So you can save this values at a serial terminal and plot a graphic or use the angle for other things.

If you need any explanation about the code fell free to ask.

The code is ziped. Just unzipe, open and upload it to your arduino.

Step 5: Testing and conclusion

To test the system I saved the data using a program called Termite, then import this data at excel and plot the graphic to see how good my filter is. The results are amazing. Of course you can use the signal to drive a motor, or other things.

Any comments, any doubt, any information missing, just tell me and I correct it.

Please if you like this, rate.

Thank you all.
Read more ...

DIY portable LED strobe

Thursday, 25 July 2013

DIY portable LED strobe






I and my friends like to have fun in summer. We like to fool around with music when we are camping. To make those parties more likely to professional ones I have made portable 9V LED strobe. For my surprise it really gives a big effect. I hope you will like it!


Step 1: Tools

Here is the list of tools you will (mostly) need:
1)marker;
2)ruller;
3)pliers;
4)screwdriver;
5)knife (or wood carving knife)
6)1, 3, 6 and 7mm drill bits;
7)drill stand or dremel tool;
8)sanding paper;
9)solder or soldering station;
10)lead solder;
11)flux.

Step 2: Schematic and PCB

This project is very simple but there isn't as much schematics on the internet as I thought it will be. But I'm happy because I found this one. It is really simple and cheap. All the parts (including the case) can be found at local radioshack just for a few dollars. And what is really cool that it can be done in one day!
The heart of this schematic is timer LM555. It generates square impulses which width is regulated by variable resistor or potentiometer (it really doesn't mater which will be used).
Light board can be made from as many LEDs as you want. Starting from 3 LEDs and increasing by 3 (for example it can be 3, 6, 9, 12. 15 and etc.). I have chosen 60 LEDs for brighter light
I have uploaded my schematic and PCB in Eagle and .pdf formats. My main board is really small. You can make it smaller if you use SMD parts but it's necessary. LED board is 87x57mm size (perfectly fits into my case).

Step 3: Parts

Bill of materials (BOM) for electronics can be found in .txt file that I have attached. All those parts will cost just few dollars. Maybe LEDs will cost more.

Of course you will need some parts for case assembly such as:
1)8xM3 screws;
2)two small screws for switch mounting;
3)4x10mm metal holder;
4)4x22mm metal holder;
5)case (I have used plastic 90x60x25mm).

Also there is 9V battery holder, some wire, DC jack, switch and variable resistor knob (I have shortened it because original was to long).

Step 4: Assembly

I forgot to take pictures of soldering part. But I think it is easy to understand from schematic and board layouts because there are just a few parts.
How you can see, I have connected switch just to battery holder. When switch is off but DC adapter is connected it still works.
Now when it is done with electronics it's time for casing!

Step 5: Casing

How you can see there were no holes and fittings in my case so I had to make them.
To hold case, LED's board and organic glass in place together I have made 3mm holes for screws and those metal holders. 10mm holders were used between organic glass and LED's PCB. And those 22mm length were used inside case for holding all the parts together.

Step 6: Finishing

While finishing the strobe I thought about LED's board. I should have painted it black or even chrome. But well I have made mistake which you can avoid. It still looks nice and shiny. That organic glass really does the job. It protects LEDs from scratching.
By the way. Power supply can be from 6 to 12 volts. I use 12V indoors. It flashes brighter. And for outdoors I use 9V battery which really easily fits in case. I am happy about this my project, it really works well.

P.S. If you decide to use bigger casing you can use Joulie thief to make LEDs flash brighter from battery.
P.S.S. If you want to make color light strobe you can use RGB LEDs or cut out various colors films and clip them to the organic glass.

I hope You enjoyed it for more projects click here
Read more ...

Final Year Projects & Mini Projects Topics For E&TC, ECE,Electrica,EC Students

Saturday, 20 July 2013






HOME AND GARDEN:

7 DIGIT CODE LOCK
ABSORBTION TYPE METEL DETECTOR
ALTERNATING FLASHER
AUTOMATIC SLIDING DOOR
BURGULAR DETERRENT
CALL COUNTER
CENTRAL HEATING CONTROLLER
CH BOILER CONTROLLER
COLOUR WHEEL
CURRENT MONITOR AND ALARM
DECEPTIVE LOCK
DESICCATOR
ELECTRONIC BELLPULL
ELECTRONIC DOG
FLASHING WITH TWI LIGHT SWITCH
FOUR POSITION TOUCH DIMMER
HOTEL SWITCH
INDUSTRAIL CLOCK CONTROLLER
INFRA RED LIGHT BARRIER
JUMBO DIMMER
JUMBO DISPLAYS
LED DIRECTION INDICATOR
LIGHT SENSITIVE SWITCH
LIGHT SENSITIVE TRIGGER
LONG INTERVAL TIMER
MAINS BASED REMOTE CONTROLLER
MAINS FAILURE ALARM
MAINS VOLTAGE MONITOR
MAINS WIRING LOCATOR
METAL DETECTOR
METAL PIPE DETECTOR
MINIATURE RUNNING LIGHTS
MUSICAL GREETING CARDS
RANDOM LIGHTS CONTROLLERS
REMOTE CONTROL FOR LIGHT SWITCH 1
REMOTE CONTROL FOR LIGHT SWITCH 2
RODENTS DETERRENT
SET POINTER
SIREN
SND DIE
SMOKE AND GAS DETECTOR
STAIRCASE LIGHT CONTROLLER
SUPER DIMMER
TELEPHONE BELL SIMULATOR
TEMPERATURE REGULATOR WITH ZERO CROSSING SWITCH
TEMPERATURE SENSOR
THERMOMETER
THERMOSTAT CONTROLLED SOIL HEATING
TWIN BELL PUSH
TWIN DIMMER
TWO TONE CHIME
VENTILATOR CONTROLLED
WATCH DOG
WATER DIVINER


TEST AND MEASUREMENT:

8 CHANNEL VOLTAGE DISPLAY
AUDIO TESTER
AUTOMATIC SWITCH OFF
CALIBARATION GENERATORS
CRYSTAL TESTERS
DIVIDER CASCADE
FAST VOLTAGE CONTROLLED PULSE GENERATOR
FAULT FINDING PROBE FOR MICRO PROCESSORS
FUNCTION GENERATORS
GHZ PRE SCALER
INSTRUMENTATION AMPLIFIER
LINE BAR GENERATOR
LOGARTHAMIC SWEEP GENERATOR
LOW CURRENT AMMETER
MEASURING WITH THE BBC MICRO
METER AMPLIFIER
METERING SELECTOR
NOICE GENERATOR
OP AMP TESTER
POCKET FREQUENCY METER
PROGRAMMABLE BAUD RATE GENERATOR
RECTANGULAR PULSE GENERATOR
RMS TO DC CONVERTER
SERVO MOTOR TESTER
SIMPLE SWEEP GENERATOR
SIMPLFIED WORD COMPARATOR
TWO TONE RF TEST OSCILLATOR
VARIABLE WEIN BRIDGE OSCILLATOR
WEIN BRIDGE OSCILLATOR


TV AND VIDEO

RF MODULE FOR IDU
RGB TO MONOCHROMECONVERTER
SCART SWITCH
SYNCHRONIZATION SEPARATER 1
SYNCHRONIZATION SEPARATER 2
VIDEO AMPLIFIER FOR BLACK AND WHITE TV SETS
VIDEO BUFFER/REPEATER
VIDEO DISTRIBUTION AMPLIFER
VIDEO SELECTOR





More Links


List of Electronics(ECE) Mini/Final Year Projects

 Electronics (ECE/EEE) Mini Project Downloads

 Electronics (ECE/EEE) Final Year Project Downloads

 ECE Mini Project Topics

ECE Final Year Project Topics

Electrical (EEE) Mini Project Topics

Electrical (EEE) Final Year Project Topics

Latest List of IEEE Electronics Projects

List of ECE Wireless Networking Projects

Latest List of Microcontroller based Projects


Some  More Topics
Read more ...