Tuesday, June 23, 2015

Prototype Friendly SMD Logic-Level MOSFETs

Surface Mount

Recently I received several request for recommendations for good logic-level MOSFETs to use for prototyping. I hit the search engine at Digikey and looked for both N-FET and P-FET transistors in 8-SOIC packages without a thermal pad. This package is friendly to hand-soldering, allowing you to solder wires directly to the pins and mount it "dead-bug" style if needed for quick prototyping.

These transistor look like a good bang for the buck at a little over $1 each in quantity 10. 

N-FET, 20V, 27A, Rds = 2.45 mOhm (Vgs=4.5V), $10.36 for 10.

P-FET, 30V, 20A, Rds = 4.6mOhm (Vgs=10V),  $10.91 for 10.

These should have plenty of performance margin for applications of a few amps (watch your wire size and current rating). Once you get above a couple of amps your wiring and PCB layout become more critical but these devices can handle the current. A couple of details about these transistors. 

The N-FET is a great part for low voltage systems with an Rds of 2.75 mOhms at Vgs=2.5V! So this would work well the Raspberry Pi's 3.3V logic (or your favorite low voltage microcontroller). But be sure to keep the gate voltage below the 12V limit (not a problem when you are driving it from a logic output).

The P-FET is a 30V part because the 20V parts had a maximum gate voltage rating of 12V which would necessitate a Zener diode to protect the gate if used for high-side switching in many "12V" systems. Many "12V" battery based applications operate at up to 14V and automotive "12V" inputs are usually specified up to 16V. This P-FET can tolerate a Vgs up to 20 volts so should be fine for high-side switching of "12V" circuits.

Remember to shop around for inventory and price if you are going to be placing a large order. I love the search engine at Digikey.com but they do not always have the best price on every part. My second stop when shopping for project parts is usually Mouser.com. I need more practice with the search engine at Mouser but I am getting better.

Through-Hole

Someone requested similar options for through-hole logic-level MOSFETs for use with breadboards so I went back to the Digikey search engine and found these parts.

This was the lowest Rds (100 mOhm at Fgs=5V) N-FET in a 4-pin DIP package ($1 for 1). At the rated 2.5 amps it would be dissipating 0.63 Watts which sounds like a challenge on a breadboard but feasible on a PCB with some extra copper for spreading the heat. 

You can also use TO-220 or other SIP type packages on a breadboard. The Digikey search engine found this TO-251A 30V N-FET with an Rds of 3.2 mOhms at Vgs=4.5V, $0.81 for 1. The power dissipation should be very low until you have well exceeded the current carrying capacity of your breadboard (0.08W at 5 amps).

Super low Rds in through-hole P-FET is much tougher. They get pricey fast. This is the best bang for the buck P-FET I could find, -30V part, Rds = 10 mOhms at Vgs=-5V, $2.90 for 1. (0.25 Watts at 5 amps). 

Generally at TO-220 can dissipate around 1W without a heat-sink in free-air without damage.


I hope this information is helpful with your projects!

Shane

Saturday, June 20, 2015

Sugru Good After 3 Years in the Freezer!

I recently needed to repair an Apple 30-pin to Lighting adapter cable.

I think the cable got caught in the seat-rail when I was adjusting my car seat.


As you can see it is pretty mangled.











Sugru is my go to for cable repair. And I might have some in the freezer. I had a few packets left over from a pack a while back and I divided them between the refrigerator and freezer to see how long they would keep.

I cannot recall when I tried the last refrigerator sample but it was a solid piece of rubber when I opened the packet. I found a packet of blue in the freezer!
And the use by date passed three years ago, July 9th, 2012. But what is the worst that could happen? So I decided to give the old Sugru a shot and tried to repair the damaged cable.
The texture felt the same when I opened the packet and it seemed to work like new. The repair set up overnight and seemed fine. The repair isn't the prettiest, but I can't blame that on the Sugru.
So it looks like the freezer is the place to store your unopened Sugru!

And if you live in the UK you have 16 more days to buy stock in the Sugru company via their Equity Crowdfunding campaign

Tuesday, June 16, 2015

Substitue Battery Charger for Generac Generator



Generator Starter Battery Charger Problems 

My wife's parents have a 15kW Generac generator, model 0046753, that has a problem keeping the starting battery charged. After charging the battery the weekly auto-start would work for a month or two and then fail to start. The unit has been serviced and tested and the battery replaced without resolving the issue. I wanted to see if I could figure out how to fix the problem.




A quick Google search reveals that battery charger issues seem to be common with Generac generators (not to pick on Generac, this may be a common issue).  I found a system schematic in the owner's manual and began studying the battery charger wiring.

Generac Generator page

Generac Owner's Manual

It appears there are two configurations, both using a dedicated battery charging module. One configuration receives power via a pair of contactors that selects power from either a transformer when utility power is available or a dedicated BATTERY CHARGE WINDING when the generator is running. The other configuration has the battery charger labeled (UTILITY) which appears to indicate that the charger runs only from utility power and not while the generator is running

Why would the generator not run the battery charger from the generator's output rather than adding a separate winding and a set of contactors? I found several posts that mention that the Generac battery charger does not charge while the generator is running, so utility only charging appears to be common.

Replacement battery charger modules are available at prices starting round $120. Below is a link and photo of  a charger module similar to the one in generator I was working on.

Replacement Generac battery charger module


0A18010SRV GENERAC BATTERY CHARGER A1801
It is not my intent to cast stones at another engineer's design, but the module looks a little kludgy with the mix of internal and external parts, most encapsulated but several not. I do understand that the orange overcurrent protection devices must be able to expand to function properly.

Given the number of complaints I found online about Generac battery charging, I was reluctant to recommend another service call to replace the OEM charger module.

I suspect the core issue is that designing battery chargers is not Generac's primary focus so the battery charger was not seen as a high engineering priority. Perhaps a battery charger designed by people who are in the business of designing and selling battery chargers might be more reliable in keeping the generator starter battery topped off and ready to go.

Charger Options. 

I wanted a charger with  a few specific features:
 - designed to be left connected to the battery
 - waterproof for outdoor mounting
 - can be powered by the generator
 - good brand reputation

There are several chargers on the market designed for continuous charging of the battery during storage but the list narrows quickly once you focus on chargers that are designed for outdoor mounting. I ended up selecting the Battery Tender 800.


Battery Tender 800, $40 at Amazon

This unit is epoxy encapsulated with an  IP67 rating (which means the unit is dust tight and can tolerate submersion in water to 1 meter). It is also highly rated on Amazon (most complaints were that warranty replacement requires $10 for processing and you pay shipping).

The ability to operate on 240 VAC was a plus simply because it let me use convenient screw terminals for power attachment in the generator. Using a 120 VAC powered unit would require a large ring terminal to fit the larger Neutral terminal. The Battery Tender 800 has two mounting holes and comes with mounting screws (not used here but handy if you want to mount it in a convenient spot near your motorcycle, boat, lawnmower, et cetera). And at this price you can replace it 3 times before reaching the price of the OEM charger module.

Battery Tender 800 Owner's Manual

Danger, Will Robinson!

There are so many dangerous parts to a generator that it is hard to know where to start with warnings. You can get burned, mangled or just plain dead. You should not work on your generator unless you are confident you know what you are doing. Bet your life on it confident. Even then, it's not a good idea. Have a generator service technician install the battery charger for you. If you are so foolish as to proceed, here is what I did.

Note that while I am an electrical engineer, I have little relevant experience with 240 VAC and generators and you should not think for a minute that I know what I am doing. I know that there must be a more elegant way to accomplish the task at hand. My overriding goal was not efficiency but rather not killing myself or blowing up something.

First I went through the house shutting down sensitive electronics like the PC and TV's since I was going to turn off the power. Then I went to the generator and turned off the generator's breaker. Then I used the transfer switch to disconnect the utility power (the generator and house were now without power). Then I removed the top panel from the generator electronics board and removed the front panel of the generator to provide access to the battery bay.

240 VAC is available on terminals N1 and N1 near the bottom center of the photo. Note notch in top left of photo where I will route the power cable. The large terminal with the cable wrapped in white appears to be the NEUTRAL terminal.

Then I checked the battery voltage with my multi-meter and install the battery charger on the battery using the ring terminals. I placed the charger on top of the battery positioned so I could see the status LED.


The 240 VAC input  was available on screw terminals labeled N1 and N2. Next I cut the 120 VAC plug from the cord and crimped terminals on the wires. I could have used 120 VAC by connecting one terminal to N1 or N2 and the other to the NEUTRAL terminal (it looks like a large ring terminal would be needed). I could also have wired a short extension cord for 120 VAC and not removed the plug from the charger in case I needed to have it replaced under warranty. I will try that approach if I have to replace this charger.


Then I ran the power input lead to the back of the battery bay and through a vent at the left rear of bay. This brought the cable into the rightmost side of the engine bay where it can be routed up and into the back left corner of the electronics bay. There is a notch that allowed the electronics bay cover to be replaced without conflicting with the wire. Here is a blurry photo (how did I not see how blurry this was when I was taking the pictures).

I ran the charger cable to the back of the battery bay and through a small vent to the engine compartment and then up through a notch in the sheet metal to reach the electronics control area. It's the lamp cord looking cable just beneath the hinge.

I wanted to connect the battery charger power lead to terminals N1 and N2. First I carefully used my multi-meter and verified that there is no voltage on the terminals. Next I pretended the terminals still had lethal voltage levels and carefully placed one terminal at a time on the screw terminals (this meant two spade terminals on the terminal so I went slowly and made sure everything looked clean).

Charger terminals installed on N1 and N2.
Once the terminals were snug, I reversed the process, putting the cover back over the electronics bay (I kept the breaker off for the moment) and used the transfer switch to restore power to the house. Now I turned on the breaker on the generator and checked the status LED on the charger. The LED indicated the battery was being charged (yellow) but could have been green if the battery was already fully charged. I measured the battery voltage and verified that the voltage was increasing (if the LED indicates the battery is charging). Then I used the manual switch to start the generator.

The generator started without a problem. Finally I turned off the generator, placed the red safety cover back over the battery positive terminal and replaced the front panel on the generator. The charger has been working well for 6 months.

As of March, 2017, the generator battery charger has been working well for almost two years.

Update 1

The manufacturer has updated the design of the selected charger (for higher efficiency and 4-stage charging) and the input voltage range was reduced to 100 - 130 VAC. The new model has a red LED to indicate charging status and has a red and green battery icon to the left of the LED. The new models retain their awesome IP67 rating. Always verify the voltage range marked on the charger!

The reduced operating voltage range means you must simply have your electrician or generator service technician connect one terminal of the charger's power cable to EITHER N1 or N2 and the other to the large NEUTRAL terminal (bolt with the cable wrapped in white tape).
New design with red LED and 100-130 VAC input voltage.


Older design with a yellow LED and yellow and green battery
 icon to the left of the LED  and 100-240 VAC input voltage.

Update 2

Following a thunderstorm, the generator failed the first weekly exercise with an OVER SPEED error on the control panel. The post below describes how I diagnosed and corrected the issue. 

Friday, June 05, 2015

Bluemix, the Internet of Things and Node-RED


RTP Internet of Things Design Challenge

The Internet of Things (IoT) is all the rage these days. I have a basic understanding of the concept but wanted to learn more about the development of IoT devices. So I was excited when I heard about the RTP Internet of Things Design Challenge because it seemed like a great way to learn about IBM's Bluemix cloud tools. The link below has information about the challenge (links for information about the sponsors are at the end of this article). 

IoT Design Challenge - sponsored by The Research Triangle Park, IBM, TiE Carolinas, BKon.

Kickoff 

The first event in the Design Challenge provided an overview of IBM's Bluemix platform and how the IBM Internet of Things Foundation let's you interact with the real-world devices that make up the Internet of Things. Several hardware devices and services were demonstrated. The Bluemix platform has a free tier of service that allows you build entire IoT applications at no charge. But you do have to enter a credit card after you complete a 30 day free trail.


The IoT Foundation Service acts as the gateway for data flowing between the Bluemix cloud and your device. There are examples for several common devices (Arduino, Raspberry Pi, etc.) and instructions on how to set up a generic device if you are using another kind of device. The system also offers a device simulator that runs in a browser tab and sends information to the cloud like a real device.

Workshop 

The second event was a workshop showing the nuts and bolts of how the devices communicate with the Bluemix cloud introduced Node-RED and how it is used to process and respond to the data coming form the devices. 

Node-RED runs on Linux/OS X and allows drag-and-drop elements to provide processing functions without requiring text based programming. Node-RED lowers the barrier of entry to provide access to programming to people who come from non-programming backgrounds. Node-RED runs not only in the cloud but also directly on hardware platforms like the Raspberry Pi.

Node-RED opened with an example program (or flow) that received temperature from your device and sends a message to the debug tab of the IDE indicating if the temperature exceeds a preset threshold. This is basically the "Hello World!" of the Internet of Things, or should that be "Blink"?

This workshop is also where information was provided about project submission for the Challenge. They told us that you needed a team to submit and application for the challenge.  I went to the event solo with the goal of just learning the tools, so I had no team and no project to implement. A few of us in the same situation coalesced after the session and joined efforts. Our team became "The Observers" as a tongue in cheek reference to our initial intend to just watch and not enter a project in the competition. 

The Observers

Our team (LaVern Witherspoon, Gunes Yucel, Mike Liu and me) had a great range of backrounds. Interestingly there was very little overlap between our specific skills. LaVern (@LaVernOWithersp on Twitter) is a software engineer with experience in IP telephony, data networking, protocols and database applications for embedded platforms. Gunes (www.linkedin.com/in/gunesyucel/ on LinkedIn) is a cognitive neuroscientist with interest in UX research and mobile development. Mike is a software engineer and science researcher with a decade of experience in teaching, research and design.  Which leaves me, the hardware and microcontroller guy. We had a great set of skills and tools at our disposal and looked forward to building... something.

Finding a project to do was a little daunting. Staring at a blank canvas of unlimited possibilities is daunting. We finally settled on an actual real-word problem, an internet connected door lock control for the Raleigh MakerSpace that can be controlled from your smart-phone.

The Challenge

The problem to solve is how to provide convenient electronic lock control for members of the Raleigh MakerSpaceThe Raleigh MakerSpace has a work-space with a CNC milling machine and Laser Cutter that can be used by members on an as needed basis. The most convenient access is via an industrial overhead door with an electronic solenoid lock currently access via individual RF key-fob transmitters.

The current RF key-fob approach has many limitations including, requiring a new fob for each member, the lock must be trained to recognize each fob, the lock supports a limited number of fobs requiring operating the fob while lifting the door and extended operation of the fob can and has burned out the solenoid.


The Solution


The proposed solution requires the inter-operation of three components, a smartphone to send an unlock request, a cloud service to receive and process the request and network connected hardware controller that can control the lock. The rapid prototyping tools in Bluemix allowed us to quickly build a proof-of-concept solution that allows members to unlock the door using any smartphone that can send e-mail. This project was built by modifying existing IBM example flows in Node-RED and existing source code examples on the Arduino Yun. A member can unlock the door by sending an e-mail containing their Access Code to a gmail address. A Node-RED flow on Bluemix monitors the incoming e-mail address for the presence of the Access Code. Once a valid Access Code is received, the Node-RED flow uses the IBM IoT Service to send a message to an Arduino Yun to unlock the door. This solution is superior to the previous RF key fobs because new members do not need a RF key fob, only an Access Code. The lock does not need to be trained to recognize each RF Key-fob. Access is no longer limited by the number of RF key fobs that can be remembered by the lock. In addition, the new system allows the facility to disable a user’s Access Code without requiring keys or a key fob to be track down and returned.


Results


The final date of the event was presentation of the projects at The Frontier in RTP (a great facility with frequent events for local entrepreneurs, check them out). Below is photo of The Observers team holding our our check after we placed 2nd in the competition!

I had a great time, thank you LaVern, Gunes and Mike! I am the one rocking the Maker Faire North Carolina shirt.


Lessons Learned


There were several factors that played a roll in our success. First, we focused on an existing problem that allowed us to narrow the scope of our effort. Although stalked by feature creep, we were diligent in dropping features if it became clear we were not  going to be able to have it working to our satisfaction by the submission deadline. We focused on optimizing and explaining the benefits of the features we were able to implement. Finally, our presentation provided the information listed in the judging criteria in the order listed in the judging criteria. (This last one is like a secret super power. Do not surprise the people reviewing your project or proposal. Give them what they ask for in the order they specified. This makes it easier for them to like your product.)

Preparation also paid off in our presentation. We presented 2nd and our demo did not work because we were unable to get our Arduino Yun connected to the guest WiFi. Fortunately our next slide was Risk Factors and the first risk listed was "Adding device to WiFi network". So we demonstrated to the judges (including two IBM Fellows!) that we understood the real-world risk factors involved in rolling out an IoT device and service. It turns out most of the team demos failed due to WiFi connection issues but few if any other teams list this as a risk factor.

Given IBM's planned huge investment in the Internet of Things, it looks like Bluemix will be a player in shaping the future of IoT. I recommend checking out Bluemix and it's every growing roster of resources. I had a great time. Thank you to Research Triangle Park and the other event sponsors!Shane



Files

Here are links to the slides from our presentation and the source code on GitHub.




RTP Internet of Things Design Challenge Sponsors


The Research Triangle Park - a not for profit that is committed to supporting education, serving our partner universities, creating knowledge-based jobs across the state and improving the quality of life for all North Carolinian's.


IBM - Bluemix is an open-standards, cloud-based platform for building, managing, and running apps of all types, such as web, mobile, big data, and smart devices. 

TiE Carolinas - a not-for-profit organization with a mission to foster and support entrepreneurship in the Carolinas.

BKON - We make beacons and the software that makes them smarter.