Advertisement

Showing posts with label Electronics. Show all posts
Showing posts with label Electronics. Show all posts

Friday, July 10, 2015

MMS Photo-inator Xsi Initial Prototype Worked

The next phase of the MMS Photo-inator project was to complete the prototype.  I spent the afternoon and evening of July 3 working on the prototype.

First, I had to desolder a few more 2N6045 NPN transistors from the board I found on the hack rack at the Milwaukee Makerspace.  I needed two more transistors but I removed four just to have some spares.  I broke one of the feet off by wiggling it too much.  Putting the electrical plug under the board gave me the leverage I needed to pull the transistors off the board after the solder was removed.

The trick to removing soldered components from a circuit board is to, first, use flux to better transfer the heat to the board.  The second tip is to use copper desoldering braid to remove solder from the pins.  After removing the solder, the transistors come off pretty easily with a little force.

The next step was to add some small strips of wood to the board that the buttons were mounted to so it would stand up on its own.  I found some extra strips of wood at the Makerspace and attached them to the plywood.

Now that the board is ready, I needed to wire the connections.  Since I want to be able to assemble and disassemble the prototype easily, I decided to use terminal strips.  I attached three terminal strips to the board.  One would be used for the 12v power coming from the power supply to each light.  One strip would be used mainly to complete the 12v circuit to the collector on the transistors.  I also used one connection on that strip to connect the negative wire on the PSU to common ground.  The final strip would be used to connect the switches to the Raspberry Pi -- three sets of connectors for power in, and three sets for power out when a button was pushed.  I used either u-shaped or blade connectors on the ends of the wires to make it easier to connect the wires to the strips, switches, and lights.

After all the wiring on the prototype was done, I made ten connector wires to connect the prototype board to the breadboard for the Pi.  There are four terminal blocks on the breadboard to accept the connector wires.  One block is for the wires that send 3.3v from the Pi to the buttons.  One block is for the wires that receive the 3.3v back from the buttons.  A third block connects the lights to the transistors, completing the circuit.  The final block connects the ground wire from the PSU to the ground on the Pi.  Finally, I had to wire up all of the connections from the Pi GPIO pins to the various parts on the breadboard.  Here is the schematic.  It is also on SchemeIt at this link: http://www.digikey.com/schemeit/#1reo.

The final prototype worked exactly as I hoped.  The lights lit up and were bright.  The Pi recognized that the buttons were being pushed.  And, best of all, the Pi did not get fried.


Next, I need to work on the Python code and get all of the features working.

Saturday, June 27, 2015

Building an NPN Transistor Switch Circuit

Introduction
The next step in the MMS Photo-inator project is to design a circuit to switch the light bulbs in the buttons on an off using transistors.  The Raspberry Pi 2 can't provide enough power to make the lights bright enough but it can control electronic switches that allow a higher powered power source to turn the lights on.

Using transistors turned out to be very difficult to me.  The concept of a transistor is pretty simple but actually getting a circuit working is not.  I burned out several transistors trying different things.  I have also read various sources to learn more about transistors but it does not seem to help.  Last weekend, Royce from the Milwaukee Makerspace helped me build a circuit that worked.  I'll try to document what I learned for my own edification.

Learn About Transistors (good luck)
Here are some links to learn more about how to use NPN transistors as a switch:


Transistorized Switching Circuit
The objective is to turn three individual light bulbs on and off from my Raspberry Pi using transistors.  The basic circuit is shown below.  Note that everything, 12v PSU, RPi, and lights share the same ground.  This is important.


Transistors will be used as electronic switches to allow current from the 12v, 1.8A power supply to flow through the light bulbs.  The Pi will send a 3.3v signal to the base pin on the transistor.  This is the signal that tells the transistor to turn on the light bulb.

According to this site, the Raspberry Pi can safely put out a maximum of 16 mA per GPIO pin and a total of 50 mA on all GPIO pins.  So, I have to be careful and limit the current from the Raspberry Pi to the base of the transistor to 16mA per transistor.

Transistor Specifications
The first thing to do was to determine the characteristics of the transistor my project needed.  This site was helpful to determine what transistor to use.

The transistor has to handle the output from the power supply I will use -- 12v and 1.8A (max) -- to power the lights.  Even though the lights only draw 0.25A, the PSU can put out 1.8A.  I think it is possible for the transistor to draw the full current in some circumstances so I need a transistor that can handle the maximum current from the PSU.   The parameter for current is called Ic(max) on the datasheets.  The parameter for voltage is called VCEO (max).  When I look at the datasheet for a transistor, it has to have characteristics that fall within these two specifications.

Finally, the amount of current that the base needs must be <= 16mA.  This parameter is called IB.  To determine the IB parameter, you have to find the formula on the datasheet.  It is usually something like IC = X * IB.  Basically, divide the current for the load by X to find the current to send to the base.  In my case, the load current is 1.8A maximum.  If, for example, a particular transistor has a formula of IC = 100IB, IB would be equal to 1.8A / 100 or 18mA.

Finding a Transistor
Next, I had to find a transistor that meets the specifications.  The Milwaukee Makerspace has several NPN transistors in bulk.  I looked up the specifications for each one on the http://www.datasheets360.com/ website.  Unfortunately, none of the NPN transistors on-hand matched the requirements.  It seemed like I was going to have to buy a MOSFET transistor like this one on SparkFun.  On a hunch, I looked through the hack rack at the 'space for any parts that may have transistors and found a circuit board that had sixteen 2N6045 NPN transistors.  According to the datasheet, these transistors have an I(max) of 10A, and a VCEO (max) of 100V.  Both of these are sufficient for this project.  The IB formula for this transistor is IC/100 or 18mA in my case.  This is just a bit higher than the Pi would like but, the load should not draw that many amperes.  The nominal current that the lights will draw is 0.25A.  This means that the base current needs to be 2.5mA under normal load--well within the Pi's capacity.  Finding the circuit board was an unexpected blessing.  Thanks, Big Guy.

I was able to remove a couple of transistors from the circuit board using a soldering iron.

Resistor for the Base
Its important to prevent the transistor from pulling too much current from the Pi and damaging it.  The Pi can be protected from this by placing a resistor between the Pi and the base pin.  Determining the size resistor that is needed was a bit complicated.

First, we made a circuit with one resistor and one 12v lamp.  A regulated power supply was used to determine the minimum current that would turn on the 2N6045 transistor.  To find the exact current level that the circuit was pulling, I unplugged the positive cable from the PSU, connected the red cable from the multimeter to the positive out on the PSU, then, connected the black lead on the multimeter to the circuit.  The minimum current required to activate the transistor turned out to be 8mA.  Finally, using a multimeter to measure the volts from the base to the emitter while the light bulb was on, showed that the PSU was supplying about 1.4v at this current level.

This means that the voltage from the pin on the Pi needs to be lowered from 3.3v to 1.4v at 10mA (rounded up from 8 just to be safe).  The resistor has to remove 3.3-1.4 or 1.9 volts.  Using Ohm's law to calculate the resistance works like this:

R = V/I or
R = 1.9/0.01A or
R = 190 ohms.

Putting a 190 ohm resistor between the Pi GPIO pins and the base pins of the transistors should keep the Pi safe from pushing out too much current, while providing enough volts to activate the transistor.

I put a 180 ohm resistor (the 'space had a 180 or 220 ohm but no 190) in the circuit and connected the Pi's 3.3v output pin to the base.  The light turned on!

That was a lot of work and very frustrating at times.  I would have never made it this far without Royce.  That is what is so great about the Milwaukee Makerspace.  There is usually someone around who can help you through the rough spots.

Next, I need to remove some more resistors from the board and build a prototype of the complete MMS Photo-inator project.

Friday, October 3, 2014

Power Connector for Chromebook Fixed

After about nine months of use, the power supply for our HP Chromebook stopped charging.  It looked like some wiring broke close to the end of the connector.  Too much flexing where the cable plugs in to the computer finally caused the wire to break.  What to do?

Best Buy sells a universal charger for $55.  That's bit steep.

Fortunately, I am a member at the Milwaukee Makerspace.  A few Fridays ago, I took the broken PSU to the 'space in hopes of saving myself $55.

My first idea was to find a power supply with a similar end.  I looked through the power supplies on the hack rack at the Makerspace.  There were plenty of old PSUs on the rack but none were an exact match.

Option two was to fix the connector on the current PSU.

To start, I cut away the plastic covering on the connector to reveal the wires.  Curiously, there are three conductors in the cable -- one white, one black, and one blue.  The white wire is hot.  The black wire is the return.  No idea what the blue wire is for.  I probably would need to break open the power supply brick to see what the blue wire is connected to.

The white and black wires were a bit frayed.  This was the problem.  I cut through the wires to separate the connector from the PSU.  Next, I used a Dremel tool to grind away the hard plastic that covered the connections on the connector.

Finally, I soldered the wires to the connect.  Heat shrink tubing was used to cover the wires.  The hole thing was also wrapped with electrical tape.

A quick test showed that the repair was good.  It has been charging the Chromebook for the last few weeks.

It felt good to fix the PSU.  Plus, saving $55 pays for one month at the Makerspace.  Bonus!