Monday, January 23, 2012

Hacking a Toy

Mad Cow
To control our motorized toy, we have to first pull out any wires linking to the switch, motor, and speaker. Unfortunately, this model toy only has one motor which causes the toy to jump.
We carefully pull the fabric off of the toy in order to access the electronics located inside the toy's chassis.
I solder on extension wires to any wires that were too short for use. The purpose of these wire will be for later use when interfacing with our microcontroller.

MadCow transformation into CyborgHappyCow
MadCow has been mad all his life. I decided to make MadCow happier since he has such a great smile. However, to do this MadCow needed a new eye to see the world in a new light. So, I reamed a hole through his right eye and inserted a LDR to sense light.
Once the light becomes dimmer, the new CyborgHappyCow plays a Happy Birthday tune and then jumps for 2 secs. To play the tune, I programed the PicAxe to control pin 4 which plays through Piezo sounder with a 10 microfarad capacitor to intensify the sound.

To control MadCow's motor, I programmed the PicAxe microcontroller to power on Pin 1 which will power the motor. I used a Tip42C transistor to boost the voltage to MadCow's motor.
 So, as soon as the tune finishes playing his tune he jumps for hurray for 2 secs.

Overall, CyborgHappyCow is much happier and much more satisfied with his new and improved abilities

Introduction to Microcontrollers

Microcontroller
We will be using the PicAxe 08m as a microcontroller to control electronic components. Microcontrollers are quite useful because they are compact, programmable, control several components, and versatility. We begin by setting up a simple circuit to our microcontroller. Next, we program the microcontroller to blink for a determined duration.
 time = 0
   time > 0

We also built and programmed the same circuit except this time we use a Light Dependent Resistor (LDR) and two LEDs to show the how the microcontroller works with a sensor.

  With light.
Without light.
 
Taking a photo of this circuit proved quite difficult because the flash on my camera kept triggering the LDR which is the reason for why there was a little bit of light left in the green LED.

Build a Logic Probe

Logic Probe
Another useful tool for electronics debugging is the logic probe. A logic probe will tell you the logic of a particular point in a circuit, and whether the point has low or high voltage. We start the prototype circuit on the breadboard before soldering the circuit onto a printed circuit board.
 When the probe is powered and not testing for logic or voltage.
 When the probe touches the positive side, the LED glows even brighter.
 When the probe touches ground, the LED goes dark.

Now that we have enough practice, we move onto the fabrication lab for some surface mounting work. This requires a tedious soldering job because once a mistake is made it will be difficult to fix the mistake (I only have one PCB!). After the soldering is complete, we take an exacto knife to make the incisions necessary for this particular circuit because the PCB is made in such a way that all the pins are intertwined as one circuitry. So, our logic must thoroughly predetermined before we begin cutting.
Once we finish our board should function as it did in the breadboard and we put a little bit of hot glue to prevent any of the components from moving about the pins and short-circuiting.
 
DB9 Serial Connector
To prepare for programming and interfacing between a microcontroller and the PC, we solder the necessary wires onto a DB9 serial connector.
The wiring should look as such and shrink wrap should be used to prevent unintended wires from shorting.

Transistor Switching

Transistor
A transistor works much like a relay by switching electronic signals, except that it is much more sensitive and versatile. Today, we test the transistor to see how it differs from a relay. We start by building a simple momentary switch circuit to test the transistor and later switch the momentary switch for just two stand alone jump wires.
The yellow and blue wires that protruding upwards allows us to test the transistor with a simple touch of a finger. When electricity passes through the finger (low-resistance) the transistor receives the electricity and sends it to the LED, powering it as a result.
If you just add a little bit of moisture to your fingers, the LED will glow even brighter!


Monday, January 16, 2012

Switches, Relays, and VEX Square Bot

Switches
witches allows us to control whether a particular circuit receives power or not. For this circuit we use two single pole double throw switches, some jumper cables, a LED, a 100 ohms resistor, and a power supply.
 Both switches are set to allow current to flow, thus the LED lights up. Our next circuit uses a relay to switch from one LED to another.

Relays
Relays allows us to switch current from one circuit to another. For this circuit we need a double pull double throw relay, a single pull single throw momentary switch, two LEDs, a 680 ohms resistor, some jumper cables, and a 5 volt power supply.
Notice that only one of the LEDs are lit because the relay allows only one of them to receive power. If we hit the momentary switch, the relay will switch power over to the other LED. We can hear the relay make ratcheting noises as it switches current, which signals to us that this relay is working properly.

VEX Square Bot
Once we have finished checking our VEX inventory kit for all the necessary parts, we begin building the "square bot". The square bot is a generic bot that will be used to teach us the essentials of what a robot needs in order to function. The building instructions are quite basic and all you really need to get the bot moving is: 1. Build according to the instructions, attach all essential electronics (i.e. VEX brain controller, radio receiver, 2 motors, and a charged battery.

Schematics, Ohm's Law, and Potentiometers

Schematics
We look at our first schematic for our first simple circuit. This circuit requires a power supply, resistor, and LED.
Also, we use the same schematic without the resistor and notice that the LED no longer lights up because there was too much voltage passing through the LED.

Ohm's Law 
We use Ohm's law to determine the resistor we need for the LED and power supply to be compatible, which states:
Voltage = Current * Resistance
or
V = I * R 
Since the LED should take a current of about 20 milliAmperes and uses about 2.2 volts and our power supply produces 5 volts,
R = V / I

R = (5 - 2.2) / 0.02

R = 140 Ohms

If we push the limit and let the LED take a current of 30 milliAmperes and everything else constant,

R = (5 - 2.2) / 0.03

R = 93 Ohms

Thus, when we used a 100 ohms resistor for our circuit we were actually giving the LED a current that was above the normal amount which shortens the life of the LED.

Using a Multimeter

Multimeter Functions
A useful debugging tool for any electronics technician is the multimeter. The multimeter allows us to measure continuity, resistance, and voltage.
Measure Continuity
The first exercise is to test the continuity of the PCB we just made to evaluate whether our soldering job was well or poorly done. We turn the dial on the multimeter until the the displays shows "OL" which stands for open loop. Then, we put each probe on a lead and a voltage reading should display, meaning our soldering job was successful.

Measure Resistance
The next exercise is to measure the resistance of some resistors and a potentiometer. We start by turning the dial of the multimeter to the resistance setting which should be marked by the Greek letter omega. 
Each of these resistors has a different resistance rating. We test each resistor and compare the values to the stated value determined by the colored stripes. We find very little discrepancy between the values (about 0.02%). We then measure the resistance of a potentiometer at varying resistance settings.
Potentiometer set to the lowest resistance.
Potentiometer set to the highest resistance.

Measure Voltage
Next, we measure the voltage of batteries. Before we begin, we turn the multimeter dial to measure the voltage of DC current. We put each probe on each of the electrodes of a 1.5 volt battery.
The multimeter displays 1.6 volts which is over the manufacturer's labeled voltage, meaning this battery probably has never been used. The next battery is a 9 volt battery.
The multimeter displays 3 volts which is below the manufacturer's labeled voltage, meaning this battery has little to no energy left for use. Our next task is to measure the voltage of a transformer and a switch-mode adapter. Our 9 volt transformer uses AC current so we must set the multimeter to read AC voltage.
We immediately notice that the voltage is exorbitantly higher than the manufacture's label. This is because transformers guarantee that the voltage supplied will be above the labeled voltage. Next, we add a resistor to see the effects on the voltage.
The voltage falls as expected. Next, we measure the voltage of a switch-mode adapter. We use the 5 volt power supply for our breadboard as a test case.
We measured about 4.8 volt which is normal for a switch-mode adapter since it is regulated.

Thursday, January 12, 2012

Introduction to Solderless Breadboards

Metal strips run in rows underneath each column of the breadboard, allowing us to test circuit designs without having to solder.
We begin by connecting the power supply we fabricated on to the power strip, then adding a 100 Ohm resistor, and finally a 5mm LED, linking each component in series.
Voila! Our first circuit.

Wednesday, January 11, 2012

Solder Practice Board and 5V Power Supply

1/10/2011

Solder Practice Board
Our first soldering exercise begins with a solder practice board where we will install resistors, ceramic, electrolytic and monolithic capacitors, diodes, LED lights by solder joints.


First, we set the components flat on the board with the leads bent outwards to ease our soldering job.
Next, we apply flux liberally onto the leads and board; add solder between the tip of the soldering iron and lead, covering the pad completely with a shiny solder cone on top. We then cut off the excess leads, protruding from the board.
I made the mistake of adding too much solder to one of the joints, making one of the slots unusable.


5V Power Supply
Before we begin making the power supply for our bread board, we will make a hoop by practicing wire splices.
Cut part of the plastic off the wire; add flux, and a little bit of solder; then repeat for a second wire. Bring both wire into parallel contact, where both wires have optimal surface area contact between each other; solder the joint; add shrink wrap; and heat the shrink wrap. Now, we are ready for the power supply.

Cut the plug; split the positive wire from the negative wire and cut a small chunk of insulation off the wire so we can begin soldering; add flux and solder to each wire; prepare the two-lead connector with flux and solder as well; prepare shrink wrap before making connection; solder each joint briefly to avoid the leads from burning the plastic; heat the shrink wrap, completing the joint.
We finish by testing the strength of the connection and polarity of the wires to insure we have a reliable power supply for our bread board.