Thursday 2 October 2014

Light Following Robot

Light Following Robot Using 555 Timers.


I actually made this towards the end of March, i became interested in using integrated circuit and micro chips to make stand alone projects as they are cheaper than using an arduino for each project.

There are two configurations for 555 timers mono stable and astable. For this project monostable is used. A great website explaining how they work.


Monostable Operation

"Unlike the astable, which has two unstable states and so continually switches from one to the other and back again, the monstable has one stable state and one unstable state.
When triggered by a suitable pulse at its input (pin 2) it switches from its stable state, in which the output is low, to its unstable state where its output is high. This state exists for a time controlled by the values of R1 and C1, and at the end of this period the output switches back to its stable (low) state. Its primary use is therefore to produce a set time delay, initiated by an input pulse."


Quote and image taken from http://www.learnabout-electronics.org/

Building The LFR

I followed this instructables it was the most simple one i could find, there are other tutorials out there that use potentiometers to set the sensitivity of the LDR's and hence the speed of the motors.




Conclusion

The idea worked however the LFR didnt really move.. i didnt have proper wheels, i cut some out from cardboard. Also the fact i didn't use motors with gear boxes and gave the motors more voltage than they needed resulted in not much torque.

For my first play with 555 timers i am still happy with the out come. Ultimately i decided that having a mobile platform that i could add sensors to and program would be a better use of my time and didn't continue with it.

Sunday 21 September 2014

433Mhz RF Transmitter and Receiver

433Mhz RF Transmitter and Receiver.


I wanted a cheap wireless solution, these are great at little over a pound each. 
This is a great instructables on them with all the specs. Limitations are that they easily loose connection with each other, and don't really have enough power to go through more than one wall (on 5v) a max range of 100 M can be achieved with LOS (line of sight) also the direction of the antenna greatly affects performance.


Virtual Wire

The VirtualWire library allows you to easily communicate over RF. Official VirtualWire Documentation (PDF).


Test project

I wanted to control a coffee machine using these the idea was to have a button on my desk with an RGB LED, off: the LED would pulse red, brewing: the led would stay yellow and ready: the LED would pulse green.

First prototype: got the led to work correctly with me pushing the button it would cycle through the colors no problem.

Second prototype: Modified the example Tx and Rx code from virtual wire library to send a 1 then 0 with a second gap in between. added relay to control coffee machine. 

Third prototype: combined both codes into one found that the LED wasn't working as expected it wouldn't display certain colors and i reasoned it was because the Tx part of the code being constantly sent with a small delay- this delay affected the PWM of the LED. To make it work a micro controller able to run two sets of code at the same time would be needed. But this expense is a little overkill for a simple remote coffee machine.

Forth prototype: i simplified the user experience to a simple on/off, green/red operation.
however the leds flash briefly, assume this is when data is being Tx.

Im not going to use these to remotely control my coffee machine as the connection is unreliable and unable to reach the distance to it. I'm going to test these and see if i have better luck, also i need a way of getting 5-12 V from the mains to power the Rx. 


Hardware Connections

Rx Signal Wire to D12

Tx Signal Wire to D12



Code

As i was only sending 1 or 0 i changed the following line in the set up. This is an array that holds the data you want to Tx.

char Sensor1CharMsg[2];

This line converts an integer array to a character array.

 itoa(ButtonData,ButtonCharMsg,10);
 
Great information on converting CHAR to INT and vice versa.

Tuesday 3 June 2014

Writing A Class

Writing A Class In Processing

As I'm not a programmer my understanding of the lingo needs improving I decided to investigate it. This tutorial by Daniel Shiffman (lots of good stuff on his website) helped me understand how they work.

Get to the chopper!

So me and a friend Micheal were drinking a few in my room and he suggested we make an app that when the button is pressed a random jpeg is displayed along with an mp3- we didn't get that far, but the next day i looked over it and decided to make it work but i would use classes.

Say cheese!

The Arnold app

All the libraries i used should be included with processing. A problem i couldn't work out is that i wanted to be able to be a bit "trigger happy" with the mouse button, So that if the user didn't like the mp3 being played they could simply click and a new picture and mp3 would be played. I couldn't figure it out and we think its something to do with having one audio player object, having more would overkill for a small app. The solution would be to find a new library with better features and use something "better" like Python.

Multiple Serial Ports

Exploring Multiple Serial Ports Using Arduino Mega.


I searched around for this because i will need to use it in future projects, at the moment i'm gearing up to build a mobile platform- wouldn't it be nice if it could map a room using sonar data... Anyway i found this excellent blog that explains it nearly perfectly apart from the TX to RX bit in step one, just beware, if you don't know what i'm on about I've made a comment at the bottom of his post.

Using a USB to serial TTL cable allows another serial port to be connected to a PC from the mega. 

USB To TTL Cable 

The mega has 4 possible ports to utilize. The green is TX and should be connected to RX on the board the white is RX and should be connected to TX on the board, red is power and is optional (5V external) and black is ground. the USB is simply connected to a port on the PC.

Ive put together a sketch that reads an LDR and prints the value to one serial port whilst the other port is used to keep track of when an led (the on board one connected to pin 13) is turned on and off using a button.

Resistors 10K (theres one behind the LDR)

To view two serial monitors in the arduino IDE open a fresh arduino program and set that to the serial port of your cable, or use Tera Term.

Com7 Showing LDR Values Com9 showing that switch is off


Saturday 5 April 2014

Bluetooth RGB LED

RGB LED using serial over bluetooth


Im using a HC-06 bluetooth module, its the same coding as sending data over serial but the com port is changed to the bluetooth port.

I set up a GUI with processing using the control P5 library which sends the values to the bluetooth COM port.

Desktop App


Module to Arduino RX to TX and Vice Versa



 

Saturday 29 March 2014

Xbox Pad

Xbox pad

This is something me and Ben worked on using the procontrol library he found to get and use values from the xbox pad.
Eventually he wants to use this to control an RC plane and the camera on it!


Using a pitch, yaw, gimbal to demonstrate.





Wednesday 12 February 2014

Solar tracker

Solar tracker 


Update..

Its been a while! ive got a few more projects that im working on. Im looking into building a balancing two wheeled robot, the chip im using is a MPU-6050 6-axis accelerometer/gyroscope which im having trouble getting my head around.. i found code to get values from it ive just got to find a suitable project to demonstrate it, i am also in the process of building a P.C.

I was interested in this because the code can be used for a line following robot, also for solar panel applications.

Components

A servo
Bread board
Cardboard and tape to separate the two LDR's
2 LDR's
Two resistors, im using 550 ohms
Arduino
Wires


Code

The voltage received from the LDR's is compared with each other with a tolerance of 10 added, this is to stop the servos from jittering when say a cloud passes over one of them. If one voltage is bigger than the other the servos will move in 1 degree increments untill they are equal.

The Circuit


The left LDR is connected to A1 the right to A2, between these connections is a resistor connected to ground, with the other leg of the LDR's connected to 5V.

Conclusions

The positioning/angle of the LDR's really affect the accuracy of the system, and should be as symmetrical as possible.