Thursday, January 17, 2013

06 All about Motors/ Interface micro to transistors

 
This is a singing toy "Grandma got run over by a reindeer"
before I remove the fabrics... and hack the toy.
Input transducers are electronic devices that detect changes in the real world and send signals into the process block of the electronic system.
Examples of a digital sensor for the reindeer is the microswitches in its hand


Example of input transducers for the reindeer is the push switches in one hand to detect when the toy is being 'stroked'. The microcontroller uses information from the input transducers to make decisions about how to control the output devices.


06 Driving Motors and Other Output Devices
Standard Interfacing Circuits

MSP430 microcontroller
  • only provides up to 10mA per channel and limited to about 50mA
  • possible light up about 4 to 5 LEDs from the chips
  • over loaded will burn out your microprocessor
In order to provide more current, we can use a transistor switch. The transistor will require very little current to switch a much larger load. The 2N3904 will work for low current devices, it rated to 200mA and has a gain around 25. Therefore in order to drive the transistor, we need to provide a current of 8mA.

       Current = 200 mA/25 gain
                    =  008 mA
Since the  MSP430 microcontroller runs at 3.3V internally, we need to choose a resistor that will provide at least 8mA (.008 A) Since there is a voltage drop of around 0.7V across the transistor, the resistor receives about 2.6V. We then need to choose a resistance less then 325Ω.
      
        Resistance = 2.6V/ 0.008 A = 325Ω
        We picked 330Ω because it is the closest resistance in the kit.

The standard schematic for attaching 2N3904 transistor to
MSP430 microcontroller
To interface a signal lamp the standard transistor interfacing circuit
 
 
The MPSA24 can handle up to 300V at .6 Amps of current.
(3 times as much as the little 2N3904)
With such a large gain, you only need a very small current to create a very large current.Reproduce the original transistor circuit except with the MPSA13 Darlington transistor.
DC Motors

Brushed DC Motors are widely used in applications ranging from toys to push-button adjustable car seats. Brushed DC (BDC) motors are inexpensive, easy to drive, and are readily available in all sizes and shapes.






Brushes and Commutator
BDC motors do not require a controller to switch current in the motor windings. Instead, the commutation of the windings of a BDC motors is done mechanically.

There are a number of ways motors can be interfaced to the microcontroller. Here you need to use the power Darlington transistor:

Use the wires from one of the motors on your Hacked Toy as the motor in this circuit. Turn the motors on an off by replacing the signal light with the motor wires and including a 1N4001

At this point you should now know how to use switches and your LDR (Light Dependent Resistor) as input and control the motors in your toy as output.

Wednesday, January 16, 2013

05 Introduction to Serial Bus/ Microcontrollers

Microcontrollers
Most common microcontrollers we seen are embed in consumer products, they do one task and run one specific program and generally does not changed. It is low power, often small and  inexpensive.
A microcontroller is like a 'computer in a chip' because it contains memory, processing units, and input/output circuitry in a single unit. It comes 'blank' from the shop and then programmed with a specific control program to make the product more intelligent and easier to use.

For this project, obtain the following components:
  • TIMSP430
  • Breadboard
  • Sufficient Wire
  • 4 LEDs and 4 resistors between 200-500 ohms.
    (red red brown is 220Ω and ideal)
You will need to install the Programming Environment for the chip:
http://energia.nu/download/
There are 20 pins on this chip. 16 of these are usable for digital input or output (IO-means channel is either ON or OFF) Digital IO is is much like an electric switch that can be in one or two positions. In the case of this microcontroller, ON corresponds to a +3.3V and OFF corresponds to 0V.






Here is the Blink Codes from Energia website.





  • Connect the breadboard to the LaunchPad
    The GND on the breadboard should be connected to the Pin 20 marked GND.
  • The wire connected to the positiive end of the LED should connect to Pin 6 marked P14.
  • Use a 220Ω resistor to limit current to the LED.

Here is the video showing the results with the programming codes of 1 second delay .

Here is the modified version of the blink codes to make 4 LED flash
with 4 resistors between 20 - 500Ω

 
Demonstrate LDR controlling LEDs
 


Tuesday, January 15, 2013

04 Intro to Transistors

A transistor can switch a flow of electricity, just like a relay. But it's much more sensitive and versatile.

Fingertip Switching

Concept learned from this demonstration:
A transistor amplifies any changes in current
that you apply to its base. 

Your finger is conducting positive voltage to the base of the transistor. Even though your skin has a high resistance and there is only a trickle of voltage reaching the transistor, the transistor still responds. It isn't just switching the LED on and off; it is amplifying the current applied to its base.


If you have dry skin, you might have to lick your fingers before
touching the wires for the LED to light up.


The fingertip switching demo is safe if the electricity passes just through your finger. You won't even feel it because it's 12 volts DC from a power supply of 1 amp or less. But it's not a good idea to put the finger of one hand on one wire, and the finger of your other hand on the other wire.

All about NPN and PNP transistors
A transistor is a semiconductor, it conducts electricity, but not always and its internal resistance varies depending on the power that you apply to its base.

Monday, January 14, 2013

03: Switches & Relays



This is Ronald's switch, I like it and I took a video of his work.
I will post mine when I get it done.

Vex Kit Inventory
There are bags of screws, washers, parts and micro-controller etc. for you to build a basic squarebot.

It looks confusing at first glance, but not so bad, the manual tells you exactly where to plug in each of the component and wiring.

Switches are used to control power
1. Single Pole Double Throw (SPDT -
one change-over switch)
    Has just one pole, but with two contacts.

2. Single Pole Single Throw (SPST - the simplest basic on / off switch)
    It only make contact in one direction, like most of the switches in our homes.

3. Double Pole Single Throw (DPST - two of the simplest basic on / off switches)

03 Switches and Relays 

5V power supply
2 switches
1 LED
220Ω resistor

Here is the schematic for 2 simple ON OFF switches. Below shows the breadboard interpretation of  the circuit.




I was excited to see the circuit correctly constructed and  the LED light up.










Building a Relay Driven LEDs















5V Power Supply
1-680Ω resistor
2 LED
1 Push Button Controller
1 HFD3 1/5 Relay



Below is the breadboard constructed Push button controlled relay video






















On my way to finish a SquareBot
 


My squareBot 
After installed the batteries, hookup the cables on the battery. Download Robotic firmware.
Go to menu, select Robot drop-down menu, select download, then restarting master CPU... Dual Joystick Control.
My squatBot drives nicely after installed the codes from Robotic website.




Sunday, January 13, 2013

03: Schematics, Ohm's Law and Potentiometers

 A schematic symbol is a simplified drawing of the part as shown in the example here. A wiring diagram is known as a schematic. Schematics are the standard method for people to trade information about circuits. Being able to read and write schematics is a key skill.
 

 The following 3 different resistors are used for the basic LED setup, which consists of one LED and one resistor connected from 5V to ground. 

1. Brown Black Brown: 100Ω
2. Brown Black Red: 1 KΩ
3. Brown Black Orange: 10 KΩ

The results shown that the larger the resistor, the dimmer the LED is.  A smaller resistor offers less resistance and therefore emits a brighter LED.


You adjust the brightness of the LED by changing 
the resistance on the POT

Forward Voltage and KVL
For every LED, in order to use it properly, we need to know the Forward Voltage, it is the 'negative voltage', used by the LED when it's on.

For 99 percent of LEDs, you will encounter, the optimal current is 20 milliAmperes (0.02 A).
If you want a brighter LED, you can push it up to 30mA.

Since we want to maximize the brightness of our LED using the 5V power supply
(the one I made measured 5.13V), we need to calculate the value of the resistance.

R = V/I
R = 3.8 /.02 = 164
Ω, where 3.28 is obtained by subtracting 1.85 from 5.13V

The closest resistor I find to use it in my circuit is 220
Ω because the next resistor has to be larger than 164 Ω.
  

The Fear Artist