Thursday, January 26, 2012

Project 1: Toy Hacking

Objective: This project is to hack an ordinary toy with a motor to be controlled by a microcontroller that one can program to do specific things.


My project used a remote control car in which the controller is a tilt sensor that allows the car to move forward while tilted down, or rotate 360 degrees in place while tilted up.

 I first tried soldering wires directly to the +/- terminals of the motor. From working with Professor Mason, we determined that the motor inside has an H-bridge to control the two functions of the car, move and rotate. Thus swapping between these modes is a matter of flipping the polarity. However, with the wires connected directly to the motor, the rotation would only result in spooling up the wires till it gets stuck.


I then tried to figure out how to interface directly to the controller. From working with Professor Mason, I found out that the tilt sensor works by creating a short between the two wires.

Thus I decided to disconnect the wires from the tilt sensor and allow the microcontroller to produce the short.

Given that a transistor is essentially an electronically controlled switch, I reasoned that it would be perfect for the job. I connected the two terminals that went to the tilt sensor to the collector and emitter of the transistor. Then the base was connected to output 2 of the microcontroller.

I am able to program the duration of the spin and movement in picaxe programming. The high output would short the terminals, and thus make the toy rotate. The low output would open the terminals and would open the terminals.

However, when I first tried this, I ran into a problem where the terminals were constantly shorted. From working with Prof. Mason, we determined that the output of the microcontroller isn't high enough to open the terminals on an NPN transistor. I then swapped it to a PNP transistor and everything worked as planned.
An LDR sensor was added to the circuit. My aim is to use the LDR sensor to control the turn of the toy.
Here is my coding for the LDR sensor. When light is shining on the sensor, the toy will just move forward. When the sensor is covered, the toy will turn ~90 degrees.



Thursday, January 19, 2012

Day 5 Microcontroller Board

 Fig 5.1

1. In fig 5.1, the properties of transistors is tested. The transistor is essentially a switch that's controlled by a current like a valve. The current added to the transistor can open or close the valve, depending on the type of transistor if it's an always open transistor or always closed. In this case, an always open transistor was used. Here a finger was used in order to demonstrate how the minute current passed through the finger can close the "valve" of the transistor in which the LED becomes brighter.

Fig 5.2
2. A microcontroller circuit is built. This microcontroller is useful as it is an integrated circuit that can be programmed to perform many functions, and thus making it a relatively cheap, compact, and versatile means of creating a circuit that can perform many functions. 
 
Fig 5.3
3. With the microcontroller connected to the PC via a DB9 serial cable, the microcontroller is able to be programmed to perform various tasks. Here is a basic task of coding the microcontroller to blink the LED every second.

Day 4 Logic Probe



A logic probe was created. This was done with a transistor and a light. The purpose of a logic probe is to determine the function of a circuit. The transistor is useful for this as it detects current. The greater the current entering the probe, the brighter the light as it would open up the valve to allow current to flow from the collector to the emitter.

This was also our first circuit board soldering exercise.

Day 3: Switches and Relays

 Fig 3.1
1.Here, a circuit with two switches were set up in forming an OR logic gate. The operation of either switch would toggle the LED's on or off state.
Fig 3.2
2. A relay circuit was created. A relay is made up of two switches that's controlled magnetically by an inductor coil that induces a voltage when a changing current is passed through it. This changing magnetic field is created by the introduction of a pushbutton switch into the circuit. When the button is pressed, this closes the circuit and current begins flowing. This change in current produces a magnetic field in the inductor that mechanically flips a switch in the relay, and thus toggling the LEDs. 

Thursday, January 12, 2012

Day 2: Basic circuits, circuit theory, and multimeters

Fig 2.1

Fig 2.2

1.  Basic functional circuit construction with the breadboard was conducted. This is the circuit consisting of a power source, LED, and a resistor. Here we had to analyze Ohm's law in understanding the relationship between voltage, resistance, and current. This relationship was used to determine the resistance needed to maximize the brightness of an LED given the specification of 30mA of max current for the LED.  Lastly, a potentiometer is used as a variable resistor to adjust the brightness of the LED.

2. The operation and uses of a  multimeter was explored. First it was used to test for continuity between two points on a circuit. This is done by measuring the resistance between two points. Low resistance indicates continuity, while an extremely high resistance means little to no continuity.
Second, it was used to test the voltage of an AC adapter and an AC/DC adapter. Here, the multimeters show that there is a very low tolerance on the rating of these adapters, and resistors in the circuits must be used to tune the output to the desired amount.


 

Wednesday, January 11, 2012

Day 1: Beautiful Solder Joints!


 Fig.1 - placed components on the board with special attention to its placement.
 2. Started with ugly solder joints... and I gradually beautified it as I learned the art of filling in the pads while keeping the solder flat. I painted on flux onto the contact pads to remove the oxidation to increase the contact and adhesion of the solder.
 3. Handcrafted a beautiful bracelet. Spliced some wires, brushed flux on the ends, then held the ends together in parallel and in contact as I placed the soldering iron on there. As the wire became smoldering hot, I fed it solder. I repeated this until I rejoined the 4 pieces of wire. Heatshrink was then added.
4. A new interface was created for the power supply so that it can be used for circuit boards. This was done by cutting off the original plug and soldering on a two pin connector, and then heatshrinking the end. The power supply was then tested for continuity and shorts.