Tuesday, February 26, 2013

Logic Analyzer Decoding PPM and TTL Serial

In my spare time I have been teaching myself to program microcontrollers, specifically Atmel ATMega328s & ATTiny85s using the Arduino IDE.  It has been fun learning what can be done with a few lines of code and a handful of $3 ICs.  As a result, it has become necessary to better understand how devices communicate and one of the best ways to do so is with a logic analyzer.  I recently purchased a Saleae Logic 8-channel logic analyzer and went to work testing anything I had lying around.

First up was my Futaba 4 channel RC transmitter. (See this post about converting a Futaba 4 channel radio to 5 channels.)  For those who are unfamiliar with hobby grade radio control equipment, they typically use pulse-position modulation to encode stick inputs and pass the information to the servos.  The transmitter reads the position of all the inputs and encodes this information as a single pulse train as shown below.


To decode this pulse train you have to understand that RC servos are fed a pulse-width modulated signal at 50 hz. Pulse length represents position and varies from 1ms to 2ms with 1.5ms being the neutral position in most cases.  Looking at the pulse train above you can see the signal is held HIGH and the pulled LOW for a brief period. If you measure the time between the falling edges, you will see that it is about 1.50ms and the pattern repeats 5 times.  This is the position of the 5 channels encoded as a series of pulses.  Pretty cool huh?  It should be noted that Futaba uses inverted logic and other radio systems may use a signal that starts LOW and is driven HIGH.


After looking the transmitter's output, I wired the logic analyzer to the receiver and recorded another sample set.



The job of the receiver is demultiplex the PPM signal into the individual servo signals as shown above.  Channels 1-5 show how a PPM signal is usually decoded.  On the first falling edge of the PPM signal, the output for channel 1 goes HIGH, on the next falling edge of the PPM signal, the output for channel 1 goes LOW and the output for channel 2 goes HIGH and the pattern repeats until all 5 channels are decoded, at which time there is a long pause that tells the receiver to start over at channel 1 on the next falling edge.

This is where things stopped making sense.  My 4 (now 5) channel radio came with a 7 channel receiver.  Looking at the 6th channel, it can be seen that it outputs a pulse that goes LOW at the beginning of the PPM train and then HIGH again at the end.  This isn't useful for driving a servo, so I'm not sure if it was ever meant to serve a function.  Channel 7 mimics Channel 1 and Channel 8 does nothing, which confirms that it is simply a battery input.


Next I wanted to test the actual logic analyzing functions of the software.  I wired a graphic LCD to an Arduino and loaded a sample sketch that reads data from the serial UART and displays it on the screen.



Typing a simple "Hello World" in the serial monitor window, I hit enter, sending the information to the Arduino and the logic analyzer.



I added an 8N1, 9600 baud analyzer to Channel 0 and, as seen above, it decoded my "Hello World" comment also showing the 'n/' newline escape sequence at the end of the string.

So far I'm impressed at how easy this unit has been to operate and hope to put it to use in the future.

Monday, February 18, 2013

Off Grid Solar Generator - Part 2: Battery Packs

Starting from the ground up, I decided to build the battery packs first.  Needing to split up the weight so that the system will remain man portable, the batteries were split into two series wired 12V packs.  I also took this opportunity to upgrade the wire size, add fuse protection, and seal the batteries to make it possible later to add hydrogen ventilation.

To begin, the framework was divided into two smaller frames that fit tighter around the batteries.



Then trays were cut to support the batteries using aluminum sheet.  Holes were cut into the sheets and then dimple die'd to add rigidity.



 A 200 amp Class T fuse was added to each pack for short-circuit protection and mounted in an accessible location.



Installation instructions for the PROsine inverter recommend 250 MCM battery cables for runs under 6ft.  Two battery packs means two wire runs, so wire size can be reduced significantly.  Looking at ampacity guidelines, two runs of 1/0 cable has an ampacity 20% greater than a single run of 250 MCM cable.  Wanting to achieve good crimps, I made a test crimp with a new homemade tool,then cut the cable lug in half.  The results were good, the copper was solid and tight within the connector.



The 1/0 cable was cut to length, then lugs were crimped on and finished with heat shrink tubing.



Here is the pack wired up and terminated with an Anderson SB175 connector.



To finish each pack, plastic panels were cut to (semi) seal up each box.






Up next: Part 3: The inverter/charger module

Friday, February 8, 2013

Off Grid Solar Generator - Part 1: Parts and Testing

A solar generator is a handy item to have for power outages, remote backwoods camping, an off grid cabin, or perhaps the zombie apocalypse.  There are many pre-packaged options, but where is the fun in that?  

By doing some data gathering, calculating and experimentation, I concluded my base emergency loads in the house total 2400 Wh/day, with occasional additional loads for charging batteries, running computers, etc.  Loads for camping are considerably less.  Running wattage for my furnace (assuming the gas is still flowing) is fairly low, but wattage could exceed 1200 W during the startup cycle when the ignitor is on.  With that in mind I chose a Xantrex PROsine 2.0 inverter.  


The PROsine is a 2000 watt continuous pure sine wave unit.  It has a 4500 watt surge capacity, which is much better than the 2500 watt surge you typically see with a 2000 watt gas generator.  This inverter has enough oomph to start my 2HP air compressor (6HP surge).  In addition to its inverter functions, the PROsine has a built-in 100amp, 3-stage battery charger with equalizing ability and an AC transfer relay.  I chose the 12VDC model to maintain compatibility with my vehicles and other 12V accessories.


I ran the PROsine for a few years with a pair of marine deep cycle batteries I had lying around.  Their performance was adequate, but nothing to brag about.  When the time came to upgrade batteries, I looked at my budget, then purchased four 6V golf cart batteries from Sam's Club.  Golf cart batteries tend to be good performers at a fair price for people starting out in alternative energy.  My new batteries, wired in a series/parallel configuration, provide 440Ah @ 12VDC.  With most of the budget spent on batteries, I was stuck with the original 4ga cables I used with the marine deep cycles.  With an inverter the size of the PROsine, 250 MCM is usually the recommended minimum.



Taking measurements with a digital multi-meter I discovered i was losing about 0.5VDC in the cables at 20 amps DC. This severely limits the potential of the inverter at higher power levels and starting inductive loads, such as electric motors.

Up until this point, I was running the inverter as a fancy UPS device.  With a little more money in the budget this year, it was time to add the last components to finish building a true solar generator.  Shopping around, I was surprised to discover how low solar panel prices had gotten if you were willing to buy larger panels.  

I purchased three 255watt SolarWorld mono-crystaline panels and a Outback FlexMax 80 solar charge controller.  Mono-crystaline panels have good conversion efficiency (15%-17% percent) compared to their amorphous counterpart, therefore requiring about half the square footage, a bonus when hauling panels into the field.  The FlexMax 80 is a MPPT type charge controller, which has two key advantages, 1) Maximum power point tracking allows for more power to be harvested from the panels compared to a simple Pulse Width Modulated charge controller.  Conversion efficiencies are 95%-98% compared to 60%-70% for PWM controllers.  With solar still an expensive option, getting as much power as possible from your panels is important.  2) Being a MPPT type charge controller, you can wire your solar panels in a series configuration and utilize higher transmission voltages between the panels and the charge controller, resulting in lower line losses and/or smaller wires.

Since this system was to be semi man-portable, I wanted to split the 4 batteries into two separate battery "packs".  With that in mind, I also ordered a handful of battery terminals, 1/0 cable, and Anderson SB175 connectors.  SB175 connectors are typically used as high-amperage plugs for vehicle accessories such as winches, jumper cables, portable welders and inverters.  At full running wattage, the inverter will be drawing around 200 amps @ 12V, factoring in conversion efficiencies.  Since I will be running one connector on each battery pack, my total continuous rated amperage through the plugs would be 350 amps with considerably greater surge capacity.

Before going any further, it was time to rough wire the components together and test them out before any further construction.  I wired the charge controller to the batteries and set the panels outside.



Open circuit voltage was just below the rated OcV, but this was late in the day and the sun was falling fast.  I ran the cables back to the charge controller, checked the polarity and plugged them in.  The running voltage dropped to 107.5 VDC from 130 V open circuit.


I then watched the display on the charge controller and monitored the output to the batteries.  Unfortunately with the sun going down I was losing about 7 volts/min from the solar panels.  It didn't take long to drop to 70 VDC on the input, but the system was working as it should.



With everything working it was now time to turn focus to the mounting and wiring of the components.  In Part 2 I will show how the battery packs were constructed and wired.