VGA Signal Generation with PIC Feasible

Trying to turn a flawed computer monitor into an adjustable color lighting panel, I started investigating ways to generate a VGA signal. I’ve experimented with Arduino and tried to build a Teensy solution, without success so far. If I wanted full white maybe augmented by a fixed set of patterns, Emily suggested the solution of getting a VGA monitor tester.

They are available really cheaply on Amazon. (*) And even cheaper on eBay. If I just wanted full white this would be easy, fast, and cheap. But I am enchanted with the idea of adjustable color, and I also want to learn, so this whole concept is going to stay on the project to-do list somewhere. Probably not the top, but I wanted to do a bit more research before I set it aside.

One thing Emily and I noticed was that when we zoomed in on some of these VGA monitor testers, we can tell they are built around a PIC microcontroller. My first thought was “How can they do that? a PIC doesn’t have enough memory for a frame buffer.” But then i remembered that these test patterns don’t need a full frame buffer, and furthermore, neither do I for my needs. This is why I thought I could chop out the DMA code in the Teensy uVGA library to make it run on a LC, keeping only the HSYNC & VSYNC signal generation.

But if I can get the same kind of thing on a PIC, that might be even simpler. Looking up VGA timing signal requirements, I found that the official source is a specification called Generalized Timing Formula (GTF) which is available from the Video Electronics Standards Association (VESA) for $350 USD.

I didn’t want to spend that kind of money, so I turned to less official sources. I found a web site dedicated to VGA microcontroller projects and it has tables listing timing for popular VGA resolutions. I thought I should focus first on the lowest common denominator, 640×480 @ 60Hz.

The PIC16F18345 I’ve been playing with has an internal oscillator that can be configured to run at up to 32 MHz. This translates to 0.03125 microseconds per clock, which should be capable of meeting timing requirements for 640×480.

I thought about leaving the PIC out of the color signal generation entirely, have a separate circuit generate the RGB values constantly. But I learned this would confuse some computer monitors who try not to lose data. So we need to pull RGB values down to zero (black) when not actively transmitting screen data. It would be more complex than just focusing on HSYNC/VSYNC but not a deal breaker.


(*) Disclosure: As an Amazon Associate I earn from qualifying purchases.

VGA Investigation Continues with Teensy

After deciding the Arduino VGAX library was not going to serve my needs, I started researching other ways to generate a VGA signal. What became clear pretty quickly was that a standard Arduino isn’t fast enough to meet timing requirements without additional hardware support. So solutions that work entirely in software will be roughly as limited as VGAX, and those that work for higher resolutions require auxiliary hardware.

Given that fact, I started looking at VGA signal generation by a faster line of microcontrollers: the Teensy line. I have on hand a Teensy LC and a Teensy 4, and I found this thread on Teensy forums announcing a library for generating VGA signal strictly in software, no auxiliary hardware. Browsing through the Github repository of this uVGA library, it looked quite promising. However, the primary target platform is the Teensy 3. I bracket it above and below with a Teensy 4 and a Teensy LC. Would one of them be able to run this code?

An attempt to compile an uVGA example for the Teensy LC failed:

In file included from /home/roger/Arduino/libraries/uVGA/examples/HelloWorldColour/HelloWorldColour.ino:3:0:
/home/roger/Arduino/libraries/uVGA/uVGA.h:297:16: error: 'TCD_t' in 'class DMABaseClass' does not name a type
DMABaseClass::TCD_t *edma_TCD; // address of eDMA TCD registers

My best guess is that the Teensy LC lacks the direct memory access (DMA) capability uVGA requires. I’ve already been foiled once on the reduced hardware capability on a Teensy LC, so this was no surprise. DMA is critical for shuttling memory back and forth without bogging down the CPU for timing-critical tasks (like VGA signal generation) so this requirement is unlikely to be lifted.

However, since my goal is only to generate a signal outputting a single color to the entire screen, I don’t really need to shuttle data from a video frame buffer for display. If I’m willing to dig into the uVGA code, I can probably find a way to bypass the commands moving memory and accomplish my very specific goal.

Before I start doing work, though, I should see what happens when I try compiling the same uVGA example for the Teensy 4:

In file included from /home/roger/Arduino/libraries/uVGA/examples/HelloWorldColour/HelloWorldColour.ino:8:0:
/home/roger/Arduino/libraries/uVGA/uVGA_valid_settings.h:59:17: note: #pragma message: No resolution defined for this CPU frequency. Known CPU frequency: 240Mhz, 192MHz, 180Mhz, 168Mhz, 144Mhz, 96Mhz, 72Mhz, 48Mhz

It looks like the uVGA library has some hard-coded dependencies on a Teensy CPU’s frequency, and it doesn’t know what to do with the high speed of a Teensy 4. I expect that speed will open up new capabilities, but someone has to teach uVGA about a Teensy 4 before that could happen. If I’m willing to dig into uVGA code, this would be a more productive and forward-looking way to go and a positive contribution to the open source community.

But before I can realistically contemplate that project, I’ll need to become a lot more knowledgeable about VGA timing requirements.

Sparklecon 2020 Day 2: Arduino VGAX

Unlike the first day of Sparklecon 2020, I had no obligations on the second day so I was a lot more relaxed and took advantage of the opportunity to chat and socialize with others. I brought Sawppy back for day two and the cute little rover made more friends. I hope that even if they don’t decide to build their own rover, Sawppy’s new friends might pass along information to someone who would.

I also brought some stuff to tinker at the facilities made available by NUCC. Give me a table, a power strip, and WiFi and I can get a lot of work done. And having projects in progress is always a great icebreaker for fellow hardware hackers to come up and ask what I’m doing.

Last night I was surprised to learn that one of the lighting panels at NUCC is actually the backlight of an old computer LCD monitor. The LCD is gone, leaving the brilliant white background illuminating part of the room. That motivated me to dust off the giant 30-inch monitor I had with a bizarre failure mode making it useless as a computer monitor. I wasn’t quite willing to modify it destructively just yet, but I did want to explore the idea of using the monitor as a lighting panel. Preserving the LCD layer, I can illuminate things selectively without overly worrying about the pixel accuracy problems that made it useless as a monitor.

The next decision was the hardest: what hardware platform to use? I brought two flavors of Arduino Nano, two flavors of Teensy, and a Raspberry Pi. There were solutions for ESP32 as well, but I didn’t bring my dev board. I decided to start at the bottom of the ladder and started searching for Arduino libraries that generate VGA signals.

I found VGAX, which can pump out a very low resolution VGA signal of 160 x 80 pixels. The color capability is also constrained, limited to a few solid colors that reminded me of old PC CGA graphics. Perhaps they share similar root causes!

To connect my Arduino Nano to my monitor, I needed to sacrifice a VGA cable and cut it in half to expose its wires. Fortunately NUCC had a literal bucketful of them and I put one to use on this project. An electrical testing meter helped me find the right wires to use, and we were in business.

Arduino VGAX breadboard

The results were impressive in that a humble 8-bit microcontroller could produce color VGA signals. But they were not very useful in the fact that this particular library is not capable of generating full screen video, only part of the screen was filled. I thought I might have done something wrong, but the FAQ covered “How do I center the picture” so this was completely expected.

I would prefer to use the whole screen in my project, so my search for signal generation must continue elsewhere. But seeing VGAX up and running started gears turning in Emily’s brain. She had a few project ideas that might involved VGA. Today’s work gave a few more data points on technical feasibility, so some of those ideas might get dusted off in the near future. Stay tuned. In the meantime, I’ll continue my VGA exploration with a Teensy microcontroller.

Putting AA Batteries in C or D Clothing

In case it wasn’t obvious, my ambition to revive some old NiCad C batteries is more for curiosity than any practical reason. Yes, replacement would cost a few bucks, but hardly breaking the bank. In fact the C cell battery holders I bought to help charge them cost about half the cost of the battery cell, so I definitely can’t hide behind cost saving as an excuse.

Buying replacements isn’t the only thing we can try, either. I was amused when I learned that battery size adapters existed. Apparently, modern NiMH rechargeable batteries in AA form factor can meet electrical demands that formerly required C or D cell alkaline batteries, so it’s possible to put those NiMH AA cells into a sleeve that helps them fit into space designed for C or D cells.

Far from an unauthorized use or hack, such adapters are occasionally bundled along with batteries as seen at my neighborhood Costco. This pack of Energizer branded NiMH rechargeable cells are bundled with four AA to C adapters, and four AA to D adapters.

Inconveniently (or possibly simply a result of Murphy’s Law) Emily’s printer takes five batteries, and there are only four adapters of each size. This is irritating not just because of the current project, but that there are six AA NiMH batteries in this package. Thus they did not include enough adapters to use all six AA batteries…. nor would six batteries be enough to fill all eight adapters. It’s the hot dog & hot dog bun packaging issue all over again, except this mismatch is in the same package!

Back to the adapters: D-cell adapters have a physical electrical connection, as D cells are slightly longer than AA batteries. However, C cells are roughly the same length, so the AA to C adapter is a passive plastic sleeve with a hollow center and no electrical connection. This makes me think we can 3D print a few for experiment’s sake. And as Randy Glenn commented on yesterday’s entry, people have already uploaded adapters to Thingiverse, and modified versions thereof, to help people do exactly that.

Making Attempt To Revive Old NiCad Batteries

When Emily picked up an old inkjet printer from a thrift shop for less than $5, there were a lot of unknowns to explore. Most of the attention were focused on more practical items like “does it print” and “are replacement ink cartridges still available.” (Yes and yes.)

Emily noticed a few mentions of battery-powered operation and recharging the battery, but this was initially dismissed as an optional capability absent from this printer because we saw no batteries. It turns out they were cleverly hidden inside the printer’s platen.

This was an impressive feat of component packaging and we admired this work briefly before turning attention to investigating battery operation. The C battery form factor is pretty rare now, but non-rechargeable Alkaline C batteries are still available cheap. Ignoring the clearly labeled “USE Ni-Cd BATTERIES ONLY” warning, Emily put some in the printer and confirmed it was not happy with those.

C-cell batteries have fallen out of favor, as has Ni-Cad batteries, so given the small market and low volume it was no surprise directly replacement C-cell Ni-Cad batteries (*) are expensive. Costing even more than C-cell NiMH batteries of far greater capacity.

As an alternative to spending money on new NiCad, I was curious if these old cells can be revived. It’s impressive that after many years of neglect every cell still read 0.1V without load. If these were lithium chemistry rechargeable batteries, such low level of charge would have caused chemical damage inside the battery. A crude metaphor I’ve come across: the lithium battery would have starting eating itself from the inside.

But nickel-based chemistries are hardier, and there’s a chance NiCad batteries can be revived even in the face of such abuse. Can these be revived? Or are they hopeless like the Neato batteries? I bought a bunch of C-cell battery holders (*) so I can connect these old cells to my battery charger. Let’s see if they’re willing to come back to work.


(*) Disclosure: As an Amazon Associate I earn from qualifying purchases.

Examining Composite Video Signal Generated By Microcontrollers

There was a several-years-long period of my life when I spent money to build a home theater. This was sometime after DVD became popular, because the motivation was my realization of how much superior DVD picture quality was over VHS. With movies on VHS, noisy visual artifacts were a limitation of the analog magnetic medium. With movies on DVD, the media-imposed limitations were gone and now there are all these other limitations I could remove by spending money, lots of it, to do things like upgrade from composite video to S-Video connections.

Eventually home theater moved to all digital HDMI, and I stopped spending big money because even the cheapest flat panels could completely eliminate classic CRT problems like color convergence. (My personal peeve.) I thought I have left the era of CRT and composite video behind, but throwing out my pile of analog interconnects and video equipment turned out to be premature.

Now I’ve found an interest in old school video again, because they are accessible for the electronics hobbyist. It is much easier to build something to output a composite video signal rather than HDMI. Local fellow maker and tinkerer Emily likes the old school tech for aesthetics reasons in addition to accessibility. So one day we got together at one of our regular SGVTech meets to dig a little deeper into this world.

Emily brought an old portable TV with composite video input, and two candidate Arduino sketches each purporting to generate composite video. (arduino-tvout and one other whose name I can’t remember now.) I brought my ESP32 dev module running Bitluni’s composite video demo. For reference Emily had an actual composite video camera, the composite video Wikipedia page and the reference document used by Bitluni for his demo.

All three were able to get the little TV to show a picture. However, they looked very different under the oscilloscope. The [name will be filled in once I remember] sketch had the wildest waveform whose oscilloscope trace didn’t look anything like a composite video signal, but the proof is in the fact an animated 3D vector graphic cube showed up on the TV anyway. The waveform generated by arduino-tvout was a little rougher than expected, but unlike the previous, it was clearly recognizable as a composite video waveform on the oscilloscope and accepted by the TV. Waveform generated by Bitluni is the best fit with we expected to see, and matched most closely with output generated by the composite video camera.

Knowledge from tonight’s investigation will inform several of our project candidates.

 

Raspberry Pi Web Kiosk Boots Faster On Raspbian Than Ubuntu Core

My adventures into the lightweight Ubuntu Core operating system was motivated by a 14-year old laptop with Intel CPU. By multiple measures on the specification sheet, it is roughly equivalent to a modern Raspberry Pi. (~1 GHz processor, ~1GB RAM, ~30GB storage, etc.) As a test drive, I had tried setting it up as a web kiosk and failed due to incomplete graphics driver support. (Though I did get it working on a modern laptop.)

Which leads to the next question: how well does Ubuntu Core perform on a Raspberry Pi performing the exact same web kiosk task? And how does that compare to doing the same thing on Raspbian OS? They’re both variants of Linux trimmed down for less powerful hardware. Raspbian is packed with features to help computing beginners get started, and Ubuntu Core has almost no features at all to offer a clean baseline.

My workbench is not a comparison test lab so I didn’t have many copies of identical hardware for a rigorous comparison. Two monitors were close but not quite identical in resolution. (1920×1080 for the LG, 1920×1200 for the Dell.) The two Raspberry Pi should be identical, as should the microSD cards, but they’re not powered by identical power supplies. To establish a baseline, I set them both up for Raspberry Pi web kiosk using my top search hit for “Raspberry Pi Web Kiosk”. Then launched them side-by-side a few times to see how close their performance were from power-up to rendering a web page. (For this test, the Hackaday.com site.) This took approximately 40-45 seconds, sometimes one is faster and sometimes the other is faster. For some runs, the two systems were within one second of each other, sometimes they were almost 5 seconds apart. Establishing the fact this comparison method has a measuring error of several seconds.

With an error margin established, I removed one of their microSD cards and installed Ubuntu Core for Raspberry Pi 3 on it. Once initial configuration were complete, I installed snaps for the web kiosk tutorial I followed earlier for the Dell laptops. I was very curious how fast a stripped-down version of Ubuntu would perform here.

The answer: not very, at least not in the boot-up process. From power-up to displaying the web page, Ubuntu Core web kiosk took almost 80 seconds. Double the time necessary for Raspbian, and that was even with a full install of Raspbian Buster with zero optimizations. There are many tutorials online for building a Raspbian-based web kiosk with stripped-down list of components, or even starting with the slimmer Raspbian Buster Lite operating system which would only get faster.

There may be many good reasons to use Ubuntu Core on a Raspberry Pi (smaller attack surface, designed with security in mind, etc.) but this little comparison indicates boot-up speed is not one of them.

Ubuntu Core 18 Web Kiosk Experiment on Dell Inspiron 11 3180

While experimenting with Ubuntu Core 18 on a 14-year old Dell Latitude X1, I ran into problems and wanted to verify it was a hardware support issue and not a mistake on my part. So I brought my much younger Inspiron 11 (3180) up on Ubuntu Core 18 as well. It verified the issue was indeed hardware support and not my mistake, hampering functionality on the Latitude X1.

After I got my answer, I thought since I’ve already got this Inspiron 11 up and running, I might as well continue experimenting on it. I proceeded to follow through the rest of the steps in the tutorial for setting up a web kiosk on Ubuntu Core. Since this machine had recent hardware, I encountered no hardware issues and got a dedicated web kiosk machine up and running.

Browsing a few web sites, basic browser functionality seem to be present. The first missing functionality I noticed was a lack of sound. A little poking confirmed that Linux audio system ALSA is not installed as part of Ubuntu Core. If someone wants sound on their Ubuntu Core machine, they’ll have to install it. This is fits with my expectation for a bare minimum “Core” OS.

Another feature I noticed is the lack of persistent state. As far as I can tell, everything is ephemeral and lost upon reset. No cookies are preserved across sessions, and it appears the cache is flushed as well. Whether this is a bug or a feature depends on application. It would be desirable for public use web terminal where we really want to wipe everything and start over for every new user.

And it isn’t intended to be a general use web browser, anyway. The cursor can be hidden and so can the navigation bar. I enabled the navigation bar expecting a normal browser tool bar, but it is actually a very minimalist bar with a few buttons like back and refresh. There is no URL input field, as appropriate for a kiosk dedicated to serving specific pages.

Sometimes this is exactly what I would need making Ubuntu Core an ideal bare-minimum OS for an Intel-based machine. But in this day and age, those aren’t our only options. Projects along these lines are also commonly built with a Raspberry Pi. How well does Ubuntu Core work on a Raspberry Pi, compared to Raspberry Pi’s standard Raspbian OS?

Dell Latitude X1 Running Ubuntu Core 18: No Graphics But CH341 USB Serial Works

It was a pleasant surprise to see the Ubuntu Core 18 up and running on a 14-year old Dell Latitude X1, even more pleasant to see it is lightweight enough to be speedy and responsive on such old and slow hardware. But given its age, I knew not to expect everything to work on the stock i386 image. There’s no way they can package a comprehensive set of device drivers on such a compact package. I speculate it was not the intent, either. Ubuntu Core is targeted to embedded projects where it is typical to generate an OS image custom tailored to the specific hardware. So the fact it mostly works out of the box is a tremendous bonus, and the missing hardware support is not a bug.

That said, I’m not terribly interested in generating the custom device tree (or whatever mechanism Ubuntu Core uses) to utilize all peripherals on this Latitude X1. I’m more interested in working with what I already have on hand. During initial configuration I already learned that the wireless module did not work properly. What works, and what doesn’t?

Again I’m not interested in an exhaustive list, I just wanted to find enough to enable interesting projects. Getting this far meant text output and keyboard input functions in addition to wired networking. The next thing to try is to activate the graphics subsystem and mouse input. Looking on Ubuntu’s tutorial web site, I found the web kiosk example which would test hardware necessary to offer a useful set of web-related functionality.

Following the tutorial steps, I could get the machine to switch display modes, but it never got as far as showing a web browser, just a few lines I didn’t understand. At this point I wasn’t sure if I followed the procedures correctly or if the hardware failed, so I duplicated the steps with Ubuntu Core 18 running on my modern Dell Inspiron 11 (3180) laptop. I saw a web browser, so the procedures were correct and the hardware is at fault. Oh well.

Comparing what’s on screen after starting mir-kiosk on both machines, I see the gibberish lines on the X1 actually resemble the mouse arrow but distorted and scattered across interleaved lines. Lending to the hypothesis that video support on stock Ubuntu Core 18 i386 image needs some tweaks before it can support the video hardware on board a Latitude X1. The fact some lines showed up tells me it’s close, but I’m choosing not to invest the time to make it work.

The next idea is to test USB serial communications. I plugged in an Arduino Nano knockoff with the CH341 USB-serial chip and ran dmesg to learn the device was picked up, understood, and assigned a ttyUSB device path. This particular Arduino was already flashed with a sketch that sent data through the serial port, and as a crude test I used cat /dev/ttyUSB0 to see if anything comes up: it did! This is wonderful news. The Latitude X1 can act as high-level processor counterpart to a lower level controller communicating over USB serial opening up project possibilities. I’ll have to think on that for a while.

Dell Latitude X1 Now Running Ubuntu Core 18

About two years ago, an old friend was returned to me: a 2005 vintage Dell Latitude X1. It struggled to run desktop software of 2017 but speed wasn’t the point – the impressive part was that it could run software of 2017 at all. It was never a speed demon even when new, as it sacrificed raw performance for its thin and light (for its day) construction. Over the past two years, I would occasionally dust it off just to see it still running, but as software got more complex it has struggled more and more to act as a modern personal computer.

When an up-to-date Ubuntu 16 LTS desktop edition takes over 10 minutes to boot to the login screen, I had to concede it’s well past time to stop trying to run it as a desktop computer. I hate to give up on this oddball hobby to keep an old machine running modern up to date operating systems, but an interesting idea came up to keep things going: How about running a lighter-weight text-based operating system?

The overburdened desktop Ubuntu was erased to make room for Ubuntu 16.04.6 server. This is a much lighter-weight operating system. As one point of measure, it now takes only about 55 seconds from pressing the power button to a text login prompt. This is much more tolerable than >10 minutes to boot to a graphical login screen.

After I logged in, it gave me a notification that Ubuntu 18 server is available for upgrade. I’ve noticed that my desktop Ubuntu took longer to boot after upgrading from 16 to 18, and I was curious if the text-mode server edition would reflect the same. Since I had no data on this machine anyway, I upgraded to obtain that data point.

The verdict is yes, Ubuntu 18 server takes longer to boot as well. Power button to login prompt now takes 96 seconds, almost double the time for ubuntu 16 server. Actually more than double, considering some portion of that time was hardware initialization and GRUB boot selection timeout before the operating system even started loading.

That was disappointing, but there is an even more interesting experiment: What if, instead of treating this old computer as a server, I treat it as an embedded device? After all, its ~1 GHz CPU and ~1 GB RAM is roughly on par with a Raspberry Pi, and its ~30GB HDD is in the ballpark of microSD cards used in a Pi.

This is the new Ubuntu Core option for bare-bones installations, targeting IoT and other embedded projects. There is an i386 image already available to be installed on the hard drive of this 14-year old Dell laptop. Since Ubuntu Core targets connected devices, I needed a network adapter for initial setup. It looks like the Latitude X1’s WiFi adapter is not supported, but fortunately its wired Ethernet port worked.

Once up and running, I timed its boot time from power switch to login prompt: 35 seconds. Subtracting non-OS overhead, booting Ubuntu 18 Core takes almost half the time of Ubuntu 16 Server, or approaching one quarter of Ubuntu 18 Server. Very nice.

Ubuntu 18 Core makes this old laptop interesting again. Here is a device offering computing power in the ballpark of a Raspberry Pi, plus a display, keyboard, and mouse. (There’s a battery, too, but its degraded capacity barely counts.) It is far too slow to be a general desktop machine, but now it is potentially a viable platform for an embedded device project.

The story of this old workhorse is not yet over…

Functional and Useful 100W Solar Array

Once the Monoprice PowerCache 220 was connected to the Harbor Freight 100W Solar Kit (Item #63585), we have everything we need to gather a little bit of sun power and make use of it every day. Given the non-optimal solar panel position and the fact we’re close to the winter solstice, this is just about the worst case scenario for solar power. Nevertheless this system has been gathering enough power to keep all the battery-powered electronics in the house charged up. This includes daily use & charge items like cell phones, tablets, and laptop computers. Plus the occasional items like a digital camera.

There is much more we can do to improve performance of this system, but it has met a minimum level of satisfactory performance so we can leave it running as-is for a while and switch gears to other projects. The focus will eventually return to this solar power system and here are two candidate projects for later:

Physical tracking: the panels are currently just sitting indoors vertically set against a south-facing window. It was done as an easy nondestructive way to experiment. When it comes time to improve upon this configuration, we can build a more permanent outdoor installation that angles into the sun. Maybe even motorized sun tracking throughout the day!

Electrical tracking: at the moment, the solar panel output voltage is dictated by the battery being charged. This is convenient and simple to implement but not the most efficient. We can buy (or design and build our own) a “maximum power point tracking” (MPPT) charger that keeps the solar panel voltage at its most efficient level and transform that to the correct battery charging voltage. It costs some power to do this tracking & voltage conversion, but if implemented correctly, the additional power will more than offset the cost.

We’ll add these projects to the bottom of the “to-do” list. For now, behold the glory of electronics being charged by sun power.

PowerCache 220 At Work cropped

Solar Charging Plug for Monoprice PowerCache 220

The product description page for Monoprice PowerCache 220 (Item #15278) had pictures showing its solar charging input as two round ports, but there were no connector specifications. Since it was advertised as a solar power cache, it would make sense for them to be MC4 connectors. This turned out not to be the case – they were actually two identical sockets that are electrically wired in parallel.

The device comes with an AC adapter for the charging port, but using household power would miss the point of the exercise. Neither do we want to lose the option to charge from grid power, so we don’t want to just cut off the charging plug. We should find an identical plug for solar charging.

The calipers indicate this connector has an outside diameter of 7.9mm and an inside diameter of 5.5mm. There is a small pin in the center roughly 0.5 mm in diameter. Putting those dimensions into search returned a few candidates and a large number of Lenovo laptop power adapters. A fortunate association, as there is a Kensington “Universal Laptop Power Supply” already on hand. It came with a set of interchangeable plugs to fit different laptop brands. This one was purchased to power a Dell, so the Lenovo plug has sat unused. But not for long!

Kensington Laptop Power

The Lenovo laptop plug matches all the diameters, and is slightly longer. It appeared to fit in the socket nicely. Since the two charging ports are electrically parallel, we could plug the AC adapter into the other charging port. This allowed us to read the voltage on the pins of the Lenovo plug so we know where to solder the positive and negative wire.

The plastic housing of the Lenovo plug was damaged in the soldering process so this plug will probably never fit on the Kensington laptop adapter again, but that’s fine. It now has a new purpose as solar charging plug for Monoprice PowerCache 220.

Lenovo now Solar plug

Hunt for AC Inverter Finds Monoprice PowerCache 220

Now that we have a 20 amp-hour 12 volt battery, charged by a solar array delivering up to 125 watt-hours daily. To put that power to use, we’ll need an inverter to convert battery power into household 120 volt AC power. This way the collected solar power can be used for more than just charging USB devices.

An old inverter was dug out of the old equipment collection, but it could only sustain about a minute of work before it would stop, reset, and restart. This isn’t great for the electronics, but what made it intolerable to humans were the cascade of noises that devices emit when charging began. Hearing the symphony roughly once a minute was unacceptable so the search begins for a replacement AC inverter.

The Harbor Freight lineup of AC inverters were obvious candidates. Starting from a basic model just under $20 and going up from there. While investigating options outside of Harbor Freight, one stood out: Monoprice #15278  “PowerCache 220”

It is designed exactly for the task we’re building for. It can accept power from a solar array to charge its 18 amp-hour 12 volt battery. That power can be consumed directly as 12 volts DC, as 5 volt USB power, or as 120 volt AC power.

The PowerCache mostly duplicates the components already in the current solar experiment setup. Buying one might be called wasteful, but for the sake of exploration we’ll call it redundancy. This nearly doubles the battery capacity and allows more ways to put solar power to use. It is also more user-friendly than the current maze of wires and connectors. It is an enclosed unit therefore easily portable. This might come in handy if we ever have a reason to take a little portable power source on the go.

So the search that began as a search for a simple AC inverter ended up with purchase of an integrated unit that included the AC inverter and basically everything else short of the solar panels themselves.

PowerCache 220

Initial Results of Solar Generation by 100 Watt Kit

Once the replacement battery arrived, it was possible to use the power captured by the Harbor Freight 100 watt solar kit. (Item #63585) The E-Flite Power Meter tracks the cumulative solar energy pumped back into the battery every day. Over several sunny days with minimal cloud cover, the daily tally ranged from 8 amp-hours to nearly 10 amp-hours. On an overcast day, the daily tally struggled to reach 4 amp-hours. (Reminder: the solar panels are not optimally placed to face the sun in these experiments.)

At the battery voltage range of 12 to 13 volts, this means a sunny day gives us about 125 watt-hours of electricity. (12.5 volt * 10 amp-hour) An overcast day’s output drops to about 50 watt-hours. (12.5 * 4) Since the sunniest and most productive times for solar largely overlaps with the most expensive times of the time-of-use electricity rates, we can try our best to make this solar array look good, by comparing against the highest rate of 35 cents per kilowatt-hour.

Even when using that expensive rate, a sunny day’s generation only works out to a tiny bit over 4 cents of grid electricity. A cloudy day couldn’t quite make up to 2 cents worth. Rough estimates point to a meager 10 dollars a year of savings on the electric bill.

Fortunately, we’re not doing this for money, and there is room for improvement as well. The solar array can be better aligned with the sun which, from earlier experiments, we know will make a huge difference. But a more immediate concern is the fact only a few items around the house can directly use DC power. There aren’t enough cell phones and tablets to consume 125 watt-hours a day.

In order to make solar power more useful, we’ll need an inverter to take the battery’s 12 volt DC power and turn it into household 120 volt AC.

20Ah Battery.jpg

Initial Use of 100 Watt Solar Kit Hampered By Battery

For the initial round of testing, the solar panels of the Harbor Freight kit (item #63585) was set up in a very temporary way: they were leaned against the south-facing windows of the house. To measure the output, we’re enlisting another member of the parts pile, unearthed when we were digging for the lead-acid battery: an E-Flite Power Meter designed to measure electric consumption of remote-controlled aircraft motors. It can handle the expected range of voltage and amperage and as a bonus it also tracks the total power in milliamp-hours.

Based on experiments with the small 1.5 watt panel, we knew not to expect the advertised 100 watt output with this sub-optimal, non sun-tracking orientation. The power meter gave confirmation: over the sunlight hours of a winter day, the panel generated power ranging from 20 to 30 watts. This is roughly in line with the small 1.5 watt panel experiment indicating sub-optimal placement returned as little as 25% of the power compared to directly facing the sun.

The solar charge controller allowed the battery voltage to rise to 14.4 to top it off, then disconnected the battery from the panel to avoid over-charging. Once the voltage dropped to 13.8 volts the controller kept the battery at this sustained charge level for as long as the solar panel could keep it there. All this fits expectation of a charge controller doing its job properly.

But something was wrong when withdrawing power from this assembly after the sun went down. Trying to charge a cell phone at night, battery voltage quickly dropped below cutoff threshold of 12 volts and the controller halted operations. There seems to be usable battery capacity remaining but the battery should have been able to hold roughly 12.5 to 13 volts for the majority of the power delivery period.

Looks like this battery did suffer some damage when it dropped down to 6 volts while sitting neglected in storage. Time to head over to Amazon and buy a replacement lead-acid battery with a good amp-hour per dollar ratio. The best ratio varies from day to day pricing fluctuation but at the moment meant this 20 Ah unit. (Disclosure: As an Amazon Associate I earn from qualifying purchases.)

Harbor Freight #63585 100 Watt Solar Kit

Seeking more power than what a 1.5 watt solar panel could provide, it’s time to step up to the 100 watt solar kit, Harbor Freight item #63585. The manual, posted online as a PDF, fails to describe a few useful details which we’ll cover here.

Every product picture showed the four panels lined up in a row. But in fact the four panels are capable of standing separately as each panel is in their own frame and has their own folding stand. Bolting them together is optional. If the panels are to be deployed and stowed frequently, leaving them separate might make sense as the panels are much easier to handle individually.

The package content lists wires but not their length. Each panel has a 3 meter long wire permanently attached. This wire terminates in a connector common to Harbor Freight solar products but its exact type specification is unknown. It is definitely not the MC4 connector common in rooftop solar installations.

(UPDATE: Thanks to a tip in the comments, we now know this is a connector commonly used in the automotive world and can be purchased from auto parts stores. For example it is commonly used to make electric connections to trailers. While this connector follows the pattern of SAE J928 and J1239, it is not explicitly covered by either specification.)

The four panels connect into a 4-to-1 module. The four wire side are half a meter long, and the unified side has a 3 meter long wire towards the controller. A final half-meter long adapter has the unknown HF solar automotive connector on one end and a barrel connector on the other. (~5.5mm OD, ~1.5mm ID, 12mm length) The barrel connector fits into a corresponding jack on the controller.

HF 63585 100W power adapter

Adding it all up: Each of the panels can be up to 3.5 meters from the central 4-to-1 hub, and that hub can be up to 3.5 meters from the controller. The package includes a 1 meter cable to connect controller to battery.

The kit included two LED light bulbs, each of which have a 5 meter long wire. Curiously, the long wire ends in a standard light bulb socket. But instead of the 120V AC household voltage we would expect from such a socket, it carries the battery DC voltage. This is a decidedly nonstandard and confusing way to do things. (UPDATE: An earlier version of this paragraph incorrectly stated 120V AC conversion took place, a bad assumption based on the standard light bulb socket. Voltage meter told the truth and paragraph has been rewritten.)

HF 63585 100W LED bulbs

The simple charge controller covers the basics, guarding against battery overcharging and over-discharging at adjustable voltage thresholds. The manual claims there is over-current protection as well, but there appears to be no way to adjust the current limit, either for charging or for discharging.

Hunt For Larger Solar Panels

Now that the project ambitions have grown beyond a little 1.5 W solar panel from Harbor Freight (Item #62449) the hunt is on for something larger. The 1.5 watt panel is intended to trickle-charge automotive batteries and is sized well for the job. We’re aware of much larger multi-kilowatt installations for household rooftop solar. What kind of market would support solar equipment in between that range?

One answer is the outdoor activities market, where some people desire a bit of electric power while away from civilization. Cell phones won’t work in the wilderness but there are still other reasons to have a power source: LED lanterns, GPS equipment, and cameras to document the adventure. The products designed for this market place focus on size and weight, important for carrying in a backpack. But since those values aren’t important for the current experiments, there’s no reason to pay the corresponding price premium.

Another answer is the market of people who want a less rugged experience away from home: boats and RVs. While these leisure vessels have power generators, supplementing them with solar panels reduce fuel consumption and associated noise and fumes. For this market there isn’t much desire to make trade-offs for size or weight, and so we can get more watts for the dollar.

Which brings us back to Harbor Freight who offers two products for this market. A small single 15 watt panel (item #96418) or a larger package featuring an array of four 25 watt panels plus a controller module (item #63585). The constantly varying world of Harbor Freight coupons means the exact dollar-per-watt changes for any given day. But the general trend is clear: between the 15 watt kit and the 100 watt kit, we pay roughly double the money for over six times the power plus a control module to treat the battery properly. The choice was easy to make.

HF 63585 100W

Old SLA Battery for a 1.5 Watt Solar Panel

The little solar panel (Harbor Freight #62449) has proven itself to be capable of sending out 1.2 W, within reasonable reach of the 1.5 W announced on the box. However, we’ve also learned its actual power output varies tremendously depending on its orientation relative to the sun and the weather. As a result it’s not terribly useful on its own. We’ll need to add a battery in to the mix.

Enercell SLA

An old sealed lead-acid (SLA) battery from the parts pile is thereby enlisted in the project. We can start the experiment by hooking up our solar panel directly to the battery terminals. It’s not ideal, but a big lead acid can tolerate this abuse, at least in the short-term. (Never do this with lithium-ion batteries of any size.)

The volt meter indicated this battery was overly neglected in storage, because its voltage had self-discharged down to 6 volts. This is far below the recommended range for lead-acid batteries and may have caused some damage. Fortunately it was able to handle a charging cycle and held an open-circuit voltage of 12.5 volt. Good enough to continue the experiments.

Once the battery is in place to cache power delivered by the little solar panel, we can now power a 12 volt USB charger and charge a cell phone on solar power. But the small panel does not track the sun throughout the day, so it could deliver only a fraction of its maximum power. As a practical matter this means the panel need to charge the lead-acid battery over several days before enough power is collected to charge a cell phone for a single day of use.

Based on the latest findings, we can take the solar investigation in one of two directions:

  1. Wring more power from the little panel: build a sun tracker so it can face the sun throughout the day.
  2. Throw money at the problem: buy bigger solar panels.

The sun tracker can be a fun project, but it’ll have to wait. The vote was decided by the arrival of a Harbor Freight coupon for their solar kit. So: option #2 it is!

Observing Behavior of 1.5 Watt Solar Panel

Now that we have a power meter for the small solar panel (Harbor Freight #62449) it’s time to take it into the sun and see what it does. The first lesson learned is that a solar panel’s voltage range is far wider than a battery. A charged and rested “12 volt” lead-acid battery’s open-circuit voltage is around 12.5 volts, and the charging voltage should never exceed 14.4 volts. In contrast, the open-circuit voltage of this “12 volt” solar panel sitting in the sun is more than double that nominal rating. Yikes!

Open 27V

While we expect the voltage to drop as soon as a load is put on the circuit, there’s still that momentary spike of voltage which might cause problems until we better understand how to handle it. Digging through the parts pile for a test load found a 24V cooling fan that was retired due to a bad bearing. Since it was designed for 24V operation, a quick spike of 27V (or possibly higher) should not be immediately fatal. The maximum amperage listed on the label is 0.1A, which translates to a maximum power ceiling of 2.4W so it should be able to handle the power of a 1.5W solar panel.

Upon connection to the voltage output, the fan twitched but did not start turning. A tap of the fan started it turning and we can see the solar panel delivering 9.3V * 0.0328A = 0.3W. This is only 20% of the advertised power while the panel is sitting flat on the ground.

Flat 0.3W

This was in the mid winter afternoon, when the sun is already at a fairly shallow angle relative to the ground the panel was sitting on. Now we have this baseline, the next experiment is to prop up the panel so it faces the sun directly. We expect the power output to increase, and the meter will tell us by how much.

Facing 1.2W

The answer: 19.3V * 0.0625A = 1.2W, or roughly quadruple the output, just by finding a better angle into the sun. This reinforces why solar installations prefer to face into the sun and some photo-voltaic solar systems even track the sun’s movement across the sky. Since this is not a rigorous test, there may be other factors involved that may overstate (or understate) the effects. But after this experiment it should be fair to state:

  • The advertised power rating of 1.5W probably represents the most optimistic value under ideal conditions, but we can get reasonably close.
  • Orienting solar panels to face directly into the sun makes a huge difference.

Measure Output of 1.5 Watt Solar Panel for “Free”

Now that we have a small cheap solar panel (Harbor Freight #62449) to play with, we can start exploring solar panel behavior. The initial quick and dirty test was to connect it to a car USB charger and while we were able to light a little power LED, the panel didn’t do much beyond that.

Before we repeat the experiment (and tackle new ones) we’ll need a way to monitor the voltage and amperage output. The multi-meter in the standard tinkerer toolkit can perform these measurements, but not both at the same time. Aside from the obvious problem of having only a single numeric display, there’s also the fact voltage measurement has the meter wired in parallel with the circuit while the amperage measurement requires it to be in series. Constantly changing wires around would get old very quickly.

We can buy instruments that are designed to monitor power output and simultaneously track voltage and amperage. But for the sake of a small side project, we’re going back to the Harbor Freight catalog. They sell some basic digital multi meter as item numbers #69096, #90899, and #92020. These multi-meters are frequently part of the Harbor Freight “free with purchase” coupon offering, so their prices are “free” subsidized by other sales.

Two of these were wired together so one monitors voltage and the other amperage, displaying their readings side-by-side. A few zip-ties to hold the contraption together and now we have a cheap clunky power meter. Here it is, showing that the solar panel has almost 18 volts of open-circuit voltage just sitting under the light of the photo booth.

Solar power monitor

The upside of a super cheap power meter is that we would shed no tears if an experiment accidentally destroys it. The downside is that we have to be realistic about the (in)accuracy of cheap Harbor Freight instruments. For one data point, we can connect a good Fluke multi-meter to compare readings. This difference is not great but acceptable for exploration.

HB and Fluke