Thursday, January 27, 2011

DAY 9

Today I started the VEX programming. In a very short time, I was able do simple robotics manuever code. Most importantly, I got to do functions. I was able to measure and modularize my algorithm and program the bot to manuever through the maze, roughly without the encoder. Then using the encoder, the robot move more accurately and got into the box, the very first time!!! But no one was around to see it. Then everyone shows up to see it the second time but the battery was low so it didn't perform as well. I believe Shawn or Brian has the video.













'Color Sensor LeDs RGB on outputs 1,2,3 USING PWM
'Read the CDs cell on ADC 4
Low 0,1,2,3,4,5 'Set all outputs to low to turn off RGB
pause 1000

main:

w3 = 0 'This is the sum of all channels
high 1 'Set the RED channel high turns it on
low 2,3
pause 50 'Give time for the LED to turn on
readadc 0,b0 'Read the value from the LDR
high 3 'Set the BLUE Channel ON
low 1,2
pause 50
readadc 0,b2 'Read the value from the LDR into a different variable
'Apply any necessary offset for the sensitivity of the LDR
high 2 'Repeat for the GREEN Channel
low 1,3
pause 50
readadc 0,b1
b1 = b1 - 30
debug
w3 = b0 + b1 + b2 'Find the sum of the 3 color channels
'sertxd ("w3 reading ",#w3,13,10)
if w3 > 510 then nocolor 'Cut on total intensity
if w3 < class="Apple-tab-span" style="white-space:pre"> 'Cut on total intensity
if b0>b1 and b0>b2 then red
if b1>b0 and b1>b2 then green
if b2>b0 and b2>b1 then blue

goto main

nocolor:
sertxd ("nocolor",13,10)
pwmout 2,99,400 ;SET THE OUTPUT TO 5V
low 4,5
goto main

red:
sertxd ("red",13,10)
pwmout 2,99,0 ;SET THE OUTPUT TO 0V
high 4
low 5
goto main

green:
sertxd ("green",13,10)
pwmout 2,99,125 ;SET THE OUTPUT TO 1.5V
low 4
high 5
goto main

blue:
sertxd ("blue",13,10)
pwmout 2,99,250 ;SET THE OUTPUT TO 3V
high 4,5
goto main



Wednesday, January 26, 2011

DAY 8


Today I meet the "most successful chip ever". The 555 timer. The circuit took awhile to set up due to lack of parts. Finding that darn capacitor was difficult. Mainly, the I used the logic probe to check if all the connections flashed accordingly. This is was a side exercise to get us ready for the servos and signal conditioning. I had a little time to work on the oscilloscope project but the servos worked fine.




In additions, there were the motors and relay switches push button switch that needed to be look over.





Tuesday, January 25, 2011

DAY 7

Finalize Toy Hack:


Franken Chicken LIVES!!!!

Here's my initial program attempt:

main:

serout 0, N2400, (10,13)
serout 0,N2400, ("Press a key...")
serin 4,N2400,b1
serout 0,N2400,(b1)
if b1="a" then hot

goto main
hot:
serout 0, N2400, (10,13,"A is the Hot Key!")

high 1
pause 2000
low 1
pause 500
play 0,0
sound 2,(50,100)
sound 2,(100,100)
sound 2,(120,100)
pause 1000
goto main

Thursday, January 20, 2011

DAY 6

Interfacing Micro to Transistors:

Having already programmed the picaxe-08m using LEDs, switches, and LDR, it's not all that much different to programmed the toy-hacked. It turns out the Frank Chicken has only one large motor that controls all aspect of its geared movements of the beak and wings and legs. I was able to located the motor positive and negative connection and cut and re-solder a much longer wire set that runs up and to the back and down. I burned a side-hole so the wires can easily slip between the casing and I glue the wire down using hot glue.


Though it seems as simple as plugging those motor wires into the picaxe output pins. There is one more criteria for this to work. The pic only put out about few mA, not enough to run the motor. We can use a relay switch but that would be a over-kill. Relay switch is a robust circuitry for 2Amps and above. For my motor, I just need to increase my gain, so here the fabulous TIP102, darlington transistor works wonders. With this configuration I could achieve gains of 750 to a 1000, depending on the resistors. Now, I may begin programming the Franken Chicken.

......GRRRRRRRR

Music/Advance Motor Control:

I've also started playing with music and more advance motor controls. Instead of using switches or LDR as input to turn on the Franken Chicken, I use the serout Pic command that will command me to push a keyboard button and start up Franken Chicken. I simply added input, output devices to the darlington configuration.


Wednesday, January 19, 2011

DAY 5

Serial Bus:

Ah, at last, we make serial bus connectors for programming, a rare find these days because everything is going USB? A serial connection will give you a serial signal connection TX or RX versus parallel connection which will have far more communication pins used. To build this crucial programming device, we used 3 color wires solder the point of female 5, 3,2 sockets, i.e., ground, TX, and RX, respectively. This can be confusing especially if you are seeing either from the front side or the back side, do specify. So our serial connector is a RS-232 standard, i.e., logic 0 = 2.5-15V and logic 1 = -2.5 to -15V. This suggest that RS-232 voltages are inverted with respect to logic, so here logic 1 is low and logic 0 is high. Furthermore, the RS-232 bit rate is 9600.


Micro-Controller:

Now the fun begins! I was given a microcontroller PiC 12F683 or PicAxe 08m. It's got 4in, 4outs, 3ADC, and one infrared pin connections. Using breadboard and a couple of LEDs, I started making circuits for Picaxe programming. I programmed a series of LED flashes on and off at 1 second intervals.


I also implemented a switch to control the flashes. Lastly, I installed a LDR, analogue, sensor and control the LED flashes by covering/uncovering the LDR--it acts like a light switch of sort.I also implemented a switch to control the flashes. Lastly, I installed a LDR, analogue, sensor and control the LED flashes by covering/uncovering the LDR--it acts like a light switch of sort.



Dissect Toy:

Ah the real fun begins. I commence the dissection of the "Franken Chicken" The "violation" of the toy went smoothly. Removing the fur is perhaps the toughest part. Opening up the plastic casing for circuitry was a matter of 5 screws.




Tuesday, January 18, 2011

DAY 4:

Bread Board Logic Probe:



Today we make a very useful tool for electronics troubleshooting: The Logic Probe. The logic probe 'examines' the logic state at a particular point in an electronic circuit.' Basically, it can quickly gauge if the circuit connection is at high or low voltage. We use a 2N3904 transistor switch. It has 3 prongs--collector, base, emitter. Collector goes to positive, base goes to probe , and emitter to LED and common. It's fairly simple and cheap circuit to build.

Perf Board Logic Probe:

Once we have a breadboard model of the logic probe, we 'perfboard' the circuitry. It's quite straightforward, just the task of soldering can be challenging because there are so many ways of making and connecting logic probe circuitry. See below.



Transistors Switching:

The 2N3904 is a micro switch, a very popular transistor that can switch the flow of electricity, quite sensitive and versatile. It's a simple circuit that can incorporate the the finger tip as the push button. If you lick your finger and touch the circuit, the LED amplifies brightly as more current flows versus a dry finger tip. No touching with BOTH hand because it will create a complete circuit that utilizes your body to conduct the electricity. OUCH!!!

Thursday, January 13, 2011

DAY 3

Schematics,Ohm's Law, and Potentiometer:

Here we learn some basics of circuitry. First being able to read schematics, understanding the symbolism/electrical circuitry logic of the schematics are keys to trading information about circuits. The four basic symbols are resistors, power, ground, and LEDs. LED symbol depicts positive pin on left and negative pin on right. Often with simple wiring diagramming, we can reproduce simple to complex circuitry. Getting the schematics down would make the rest of this course much more enjoyable. Though some LEDs have build in resistors, typically a LED runs in series with a resistor, to create a voltage difference and drop in current. LED wouldn't light up unless there's a drop in voltage and too much current will burn it out. Since the circuit is powered by DC 5.1V, it's unlikely the LED will burn out, unless the resistance is below 100 ohms. Larger resistances will have a larger voltage drop and therefore dimmed the LED versus lower resistance on the same type LED, which will be brighter. A potentiometer was used as variable resistor to demonstrate that if you reduce the resistance, the current will increase, in which the LED will lit up brightly, but burn out. The forward Voltage and KVL helps to understand the behavior of voltage in a circuit. So in any loop circuit, the total voltage must be balanced, i.e. the amount generated = the amount used, known as KVL or Law of Voltages by Kirchoff. The forward voltage on the other hand is the "negative" voltage used by the LED. Here we use Ohm's Law, V=IR, to determine the voltage with give resistance and current. An unknown current can also be calculated give the resistance and voltage. By combining the concept of Ohm's Law and KVL, the brightness of the LED can be maximized using the 5.1V DC power supply and calculating for the resistance. The forward voltage of the LED taking into consideration here, which is usually about 2V.

Relays and Switches:

In this session, we learn how to turn our LEDs on and off using switches. We used a mini slide switch for breadboard and a slide switch. Then we develop a relay driven LEDs that uses low voltage or small current to 'switch' a larger voltage or hight current. It looks like relay has coils inside that increase the 'gain' of your switching energy. In the first relay driven LED, a push button will turn one light on and the other one off, vice versa; this relay was DPDT. Then we made a relay oscillator that switches on and off very quickly, so quickly that it sounds like a motor. A capacitor is added to slow the relay down and prevent it from burning out.


Wednesday, January 12, 2011

DAY 2

Today was a busy day.
We got 3 handouts.
1. Using the multimeter
2. Introduction to using breadboard
3. Schematics, Ohm's Law and Potentiometers

Using the Multmeter:

Primarily we did mini exercises on continuity measurements, resistance measurements, and voltage measurements. On the continuity test, we used the ohm or resistance measurement of the multimeter. We used the circuit board we mad and check for breaks in the circuit. Since continuity in the circuit is non-directional, we can probe the board in any directions. We tuned the meter to a short-circuit beeper and so if there is continuity, it would beep. Resistor above a 100 ohm did not beep. Large capacitor beeps, small do not. OL also shows that the circuit is not connected.

Voltage Testing:

We learned of the science of AC/DC source. Alternating Current versus Direct
Current. I used the 5V power supply/transformer from yesterday as the main power source; the transformer steps down the 120V AC down to a 5V DC. To check voltages, we switch the mulitmeter's mode to DC Voltage. Using the probe, we test across 9V and 1.5V D batteries. Voltage is testable only when the circuit is powered on. In case of odd readings, use a "reference voltage" at hand to check if the meter working properly. Since voltage is directional, you can get positive or negative reading; regardless, always have the black probe on reference or ground. Lastly, we tested the wall wart. On a unregulated wall wart, the voltage measured is AT LEAST what's printed on the case. We used a 13.3 V unregulated rated at 12V which measure the voltage to be 11.1V with a 470 ohm resistor. However, a SWITCH MODE adaptor is lighter and smaller and are regulated. The one I made from yesterday was rated at 5.1 V and the meter reading was at 5.11V, incredibly accurate.


We also tested the wall output using the voltage meter. We measured it at 121.8V. In addition, we tested 5 resistor and learn to read the color of the resistors for it's value in resistance. A good mnemonic rhyme is Bad Beer Rots Our Young Gut But Vodka Goes Well, 0123456789, respectively. Lastly, we worked with a potentiometer and light sensor. The potentiometer acts like a logarithmic variable resistor and the light sensor increases in resistance with less lumens and decrease in resistances in more lumens.

Resistor Reading:


Tuesday, January 11, 2011

DAY 1

We went over the safety criteria for the class. We took a safety test that requires a 100% as passing. We went downstairs and practice soldering on a protoboard.




I completed the board with 40+ soldering points. You'll notice the good soldering is silvery and filled. The poor soldering is not as filled and not as silvery. I cut the ends of a 5.1V, 0.7 A cell phone power supply, split the wire and solder two leads to it, a black for ground and a red for power. Then I wrap heat shrinks onto the two leads soldered.

Pictures were taken of the protoboard and power supply unit for verification