Thursday, January 27, 2011

First Vex Robot Programming 1/27

Today we wrote code for our first two programs controlling the Vex robot. Both programs were to guide the robot through a maze in the hall way. The first program was done by motor speed control and timing. The second program included input from wheel encoders. After the first attempt without the sensors, it was obvious that speed was a major factor because the wheels did not have a good grip on the floor. With this in mind, my second program had a much slower speed. Here is the result of the second attempt.

Servos, Signal Conditioning,Oscilloscopes, and 555 Timer 1/27

Today in lab I learned about a popular chip, the 555 timer. This chip allows us to generate different output signals by simply changing the values of resistors and capacitor. In the below circuit you can see the chip in action. I have connected a speaker to the output and the result was a buzzing sound from the speaker. With the twist of the potentiometer, the frequency output by the speaker was changed.


As you can see in the picture below, when the resistance of the potentiometer is changed the frequency as well as the duty cycle is affected.

For the second circuit, we used an op amp to condition an audio signal output from the computer. We first used the oscilloscope to see the signal being generated by the computer.

Similar to the previous circuit, when the potentiometer is turned, the output is affected. This time the amplitude of the signal was amplified. As you can see in the below picture, the tops and bottoms are now flat because of the limited power being input to the op amp chip.

Wednesday, January 26, 2011

Toy Hacking 101 Part 2

Today I finished up the toy. This is a video of the toy singing and dancing after the circuit was reinstalled into the frame. The toy also is able to be reprogrammed by pushing a momentary switch located in the battery panel.


Here is a video of the toy with the mechanical and electrical parts stuffed back inside. The only connections needed are the Tx, Rx, and Ground for the serial connection and power and ground for the extra battery power. 

Thursday, January 20, 2011

Toy Hacking 101

This session I will be taking a stuffed duck that has two motors, one to flap its wings and one to open the bill, and a speaker, and I will be taking control of each of these components. Here we see the initial deconstruction step of the animal. The skin was removed from the skeleton.
After further dismantling, we see exactly where the motors and speaker are connected to the main board. Soon these wires will be snipped off and the board removed.


Here is a short video of my progress.

Microcontroller Interfacing 1/20

Today I learned how to interface our microcontroller with transistors initially to light a Christmas light and ultimately a motor. We need to use transistors because our microcontroller is limited to only 50mA per channel.
In the first circuit you can see the light shining bright with the help from our transistor. Our transistor acts as a current multiplier. With the small current sent out from our microcontroller 8mA, we were able to get 200mA through our light because the transistor has a gain of 25.


Today I also was able to disassemble a mechanical stuffed animal and control its motors using the PIC. Here you see the skinned animal.
No animals were hurt during this experiment.
Here we see the inner workings of the animal. I will be removing the circuit board and replacing it with my own. After the project is complete, this duck will communicate with a computer through its serial port, and will allow the user to select a song to which the duck will sing and dance.
 Here is a video of the PIC controlling the motor.


Introduction to Microcontrollers 1/19

Today we were introduced to the PicAXE 08M microcontroller. This first program I wrote was a basic one that would switch an LED on and off. After some tweaking of the program and taking advantage of the multiple outputs, I was able to have the PIC flash 3 LEDs. The picture shows the initial setup and code. There is a short video of the LEDs in action.



The next circuit for the day included a microswitch as an input to the PIC and 1 LED. When the button was pressed, the LED would light. In the circuit below, the switch was swapped for a light dependent resistor(LDR). The LDR shows a higher resistance with less light. The code for this circuit included 2 IF statements. If the LDR was in the light then the red LED was lit. If the LDR was in darkness, The green LED was lit. If the LDR was in the shade, not too dark or too light, neither LED would be lit. As you can see in the photos below, the first shows the LDR in the direct light.

 In the next pictures, the LDR is half covered making both LED dark, and the last picture has the LDR completely covered making the green LED bright.


Wednesday, January 19, 2011

Transistor switching and building a logic probe 1/18/2011

Today we will be experimenting with transistors. In our first circuit, we will be using the transistor as a switch. The transistor has a collector, base and emitter. In the first picture, on the left side you can see the circuit we will be building. The top connection will be the collector, the middle will be the base and the bottom will be the emitter. From the picture you can see that the base is functions like a gate where it controls the current flowing from collector to emitter. The gate is opened by flowing current through the base. 
The second circuit we removed the R2 resistor and used our fingertip to complete the circuit to the base.
As you can see my finger acts as a resistor and allows current to flow through the base which opens the gate to flow current from collector to emitter.
The next experiment with transistors will be to create a logic probe. 


Saturday, January 15, 2011

Switches, relays and construction of my robot 1/13/11

Today we experimented with switches and relays. In our first experiment we had two switches in series with our LED where both switches has to be in position 1 or in position 2 for the LED to be lit. In the second experiment only one switch was used and the other was replaced by a relay. With the relay we are using today, there will always be a path for our current to flow through one of the LEDs. When the switch is open, the power is flowing through the green LED as shown in the picture. 
The green component is a monetary switch. The black component is our relay.


 I was having a little trouble having the relay stay in the board so I had to hold it in with my finger. The next figure shows the same circuit with the monetary button being depressed to close the relay and change the path of current to flow to the red LED.

In the last circuit for the day, we made an oscillator. We did this by adding a capacitor in parallel with our relay. When this circuit is running and the button is pressed, the LEDs will flash one at a time. Also you can hear the inner workings of the relays switching between contacts. This sound is similar to a buzzing sound. A quick note to remember is that the larger the capacitor the slower the rate at which the relay switches.
The black cylindrical component is our capacitor.

 Here is a couple photos of our completed robot fitted with a front and rear bumper buttons. Also the battery pack up top will be exchanged for a rechargeable battery.

Wednesday, January 12, 2011

Basic electrical tools and compenents 1/12/11

Today we were introduced to the multimeter. We first set the meter to read resistance so we could check for continuity. If their was a low resistance between the two probes we had continuity. After checking several points from our circuit we soldered yesterday we checked our power supplies which we had made yesterday as well. If there was continuity, there was something wrong and it shouldn't be plugged in. If we were reading an open circuit or high resistance we were safe to plug it in. Once we plugged in our supply we read the output voltage. About 5.1 volts was average for our 5V regulated supply. Next we created our first circuit. We connected a 467 ohm resistor and LED light in series and connected it to our supply. After we added two more circuits in parrallel with the first also one resistor and LED but with 1K ohms and 10K ohms respectively. The results shown below confirm our calculations and the lower the resistance the brighter the light.
Lowest resistance on top.

So if the lower the resistance the brighter the LED, then why not put the LED directly to the power source? Wouldn't this give us the brightest possible output?

The answer, NO. If the LED does not have any resistance to impede the current, it will burn out. From the data sheet, the voltage drop across our LED will range from about 1.85-2.5V. Our power supply is giving a constant 5.1V. This means that the voltage across our resistor will be anywhere from 2.5-3.15V. Also from the data sheet, the suggested max current for our LED is 30mA. So after rearranging Ohm's law V=IR to V/I=R. 3.15V/0.030A = 105 Ohms for our high and 2.5V/0.030A = 83 Ohms for our low end. Here is the result with an 83 Ohm resistor.
Very bright!
The voltage measured across the resistor was just about 3V. V/R=I so 3V/83Ohms = 0.036A or 36mA which is a tad bit over the data sheet. I didn't let the LED stay on for too long.

Next we were introduced to a magical resistor AKA potentiometer AKA pot. This new component can vary its resistance with the turn of the knob. I measured this pot to be a 2K Ohm pot which means its resistance can anywhere between 0 and 2000 Ohms. The picture below shows the circuit with the pot in series with a 467 Ohm resistor in series with the LED with the pot at its highest resistance. As you can see, the LED is very dim.
 Here is the same circuit, but with the pot set to its lowest resistance. Much brighter!

Tuesday, January 11, 2011

Intro to soldering and building a 5v power supply

Today we learned the correct way to solder components to a circuit board. As seen in the picture below, the end result should be shiny not dull, the solder should be in the shape of a volcano, and the leads should extend slightly above the solder.
 Next we cut long wires into leads by stripping off the ends about 3/4 of an inch. After cutting the leads we then spliced 4 sets by soldering them in the middle. The solder should also be shiny and coat the entire connection.

After mastering the splicing technique, we cut the end off a 5V phone charger and spliced in our own leads. Once the leads were spliced we used heat shrink on the soldered area to prevent shorting.