FreeNAS Successfully Recovered From Failed Drive

One of the major reasons to set up a FreeNAS machine with ZFS volume is to ensure that network storage data is always available in a redundant manner to ensure everything will still be OK after a hard drive inevitably fails. But before theory can be put into practice, we had to wait for a drive to actually fail. In that sense, today is our lucky day.

FreeNAS Critical Alert Box

A drive failed to respond to some commands and returned errors in the wee hours of the morning. Although it appears to have since recovered and is functioning, we shouldn’t be comforted by the momentary blip – it is almost certainly a sign of things to come if we continue to use this drive. So we’ll replace it instead of waiting for a catastrophic failure.

The instructions to replace a failing drive is covered in the FreeNAS manual. Following the procedures, the drive was taken offline in the Storage/Volume Status screen.

FreeNAS Volume Status

Then we go to Storage/View Disks screen to retrieve the identifying serial number. This ensures that we remove the correct physical drive from the computer by comparing this serial number against the number on the physical label on the drive.

FreeNAS Storage View Disks

Since this FreeNAS machine does not have hot swap capability, it then had to be shut down for the actual drive replacement. Once the machine restarts, we go back into Storage/Volume Status and select “Replace”. (The button next to “Offline” we clicked earlier.) If there’s any existing data on the replacement drive, FreeNAS will double-check to make sure it’s OK for the replacement drive to be overwritten.

FreeNAS Force Replace

And after that… we wait for the data from the remaining good drive to be replicated to the newly installed replacement drive.

FreeNAS Resilver In Progress

This procedure will take several hours and this time is technically a window of vulnerability – if the remaining good drive fails during this time we’ll lose data. To guard against this, ZFS allows even deeper redundancy by using more than two hard drives. In the case of this server, the data is not critical enough to warrant such protection and we’ll just cross our fingers the remaining drive does not fail during the recovery process.

Duet Display External Monitor: High Resolution and Features to Match High Price

Having multiple monitors is a great luxury. Not everyone appreciates it, but those that get used to it miss it greatly when traveling. It’s the biggest downside of using a MacBook Air as the travel laptop. It is smaller and lighter than the homebuilt external monitor, making it kind of silly to use them together. When light weight and portability is important enough to take the MacBook Air, we’ll also need the external screen to be equally portable.

The search for a thin-and-light external screen companion started with units that receive both power and data via the USB port. Sadly most of them offered only a low 1366×768 resolution at the starting $100 price range. Very few offer 1920×1080 resolution and they are in the $200 range. To get resolution any higher than that, we’ll need an iPad running Duet Display. Which means spending >$300. The good news is, for that price, the system worked very well with only two caveats:

First, Duet uses a proprietary protocol that requires a special driver running on the computer to talk to the app running on the iPad. Installing this driver triggered several warnings from MacOS and required explicit authorization to run non-Apple code signed with the name Rahul Dewan. A web search indicated this was the name of founder and CEO of Duet Display, so that matches, but it’s still a scary action from a security perspective.

Second, application windows could not span the two monitors. They can be dragged from one to the other, but each window will show only on one monitor. If a window is dragged to straddle the divide, only half of the window will show on one monitor, and the other half is not visible anywhere.

Other than that constraint, Duet Display works well to make an iPad (2017, Model A1822) serve as an external monitor for a MacBook Air (13-inch, early 2014). The speed and responsiveness are great. So far, the performance has been indistinguishable from an external monitor connected to the MacBook Air via HDMI.

It even offers something not available on other USB external monitors: the ability to hook into Apple’s Touch Bar feature and show the bar on the iPad. Even for Apple computers that aren’t equipped with the Touch Bar.

Duet+iPad has turned out to be the most expensive of the external MacBook monitor options, but it makes a compelling case to justify its price. High resolution, super lightweight, and naturally the iPad is still a perfectly good tablet when detached from the computer.

Duet in Action


With Great NEXTEC Power Comes Dustbuster Responsibility

An old and tired Dustbuster BHD9600CHV is now upgraded with the power module of a NEXTEC LED work light. The eight-cell nickel-cadmium rechargeable battery pack built into the Dustbuster is gone since it could no longer deliver anywhere near its 9.6 nominal voltage rating. Now cordless power comes courtesy of the NEXTEC three-cell lithium-ion battery sending nominal 11.1 volts to the motor.

And what an upgrade it is! It now generates enough vacuum to pick up anything we can expect a small handheld vacuum to handle. It is now genuinely useful again and the handle blended well enough that ergonomics didn’t take a hit as I had feared. But all is not well; this upgraded super powerful Dustbuster now hints that there may be such a thing as too much power.

Intake Exhaust

The massively increased airflow is great for picking up messes, but all that air pulled into the vacuum has to exit through the exhaust. This massively increased exhaust has become a new problem that didn’t exist before. Vacuuming small objects off a surface now requires a bit of planning in terms of approach angle and the distance at which we turn on the power to the motor. Approach too shallow or turn the motor on too early, and the exhaust airflow will reach the object before the vacuum side can pick it up.

When this happens to small objects, say picking up a few peanuts on the ground, it means the peanuts run away and we have to chase it down. But when it happens to a loose clump of light objects, say an area filled with dust bunnies, it means the exhaust blows everything up into the air and we end up with an even bigger mess on our hands.

So yes, this is now a massively more powerful handheld vacuum, but that new power has consequences.

(Cross-posted to

Behold The NEXTEC Dustbuster

After waiting 24 hours, the adhesive should be fully cured. First the clamp holding the trimmed Dustbuster body to the NEXTEC battery compartment was removed. Then the screws holding the two halves together were removed. Finally the big moment: try to pull the two halves apart. If they were accidentally glued shut, it’ll be difficult to put all the components back inside the case.

With a soft pop, they opened up. The pieces that we’d want to stay together stayed together, and the parts that we want to separate separated. Whew!

Successful SPlit

From there it was straightforward to reinstall all the necessary components back in. Then the soldering iron was warmed up to make the electrical connections. The new wires are thicker gauge than the original wires, but it makes sense to upgrade the wires due to the increased battery voltage.

Assemble internals.jpg

As a cleanup task, the former charging port’s connection to the motor frame were severed. This avoids any accidental charging of the new lithium battery pack at nickel cadmium battery voltages. We’re keeping the charging connector plate solely for cosmetic reason of not leaving an empty hole in the bottom of the enclosure.

Before putting the two halves back together, it was wise to perform a quick test with the battery to verify the switch functioned and the motor is turning in the correct direction. The final step is to put the two halves back together and reinstall all the screws.

NEXTEC Dustbuster

This old Black & Decker Dustbuster is now powered by the Sears Craftsman NEXTEC battery system. It is definitely far more powerful than a week ago on weakened Ni-Cad battery cells. And likely far more powerful than when it was new. It may even be more powerful than its modern successors, as a search indicated they are running on two-cell lithium-ion batteries instead of our three-cell upgrade.

This concludes a fun upgrade project with a practical end result.

(Cross-posted to

Cut & Paste For NEXTEC Dustbuster

All the investigation and planning has led to this point: cutting apart the old Dustbuster and the unused NEXTEC LED work light so we can put them together into a NEXTEC-powered Dustbuster. Time to deploy the Dremel and install the cutting wheel!

First the components are set out. The original plan, outlined in red, was to cut off the Dustbuster handle up to the flat internal brace, and cut the work light hinge so it will clear the Dustbuster body.

Cut 1

The handle cutoff was straightforward, and once the handles were cut off the pieces could be put up against each other. Once in place the Dustbuster body curvature was found to be more complex than originally expected, making it tough to cut the LED work light body to fit. However, the work light hinge mechanism is a simple cylinder that is almost the same diameter as the Dremel cutting wheel. It would be much easier to cut a scallop into the Dustbuster body to accommodate the cylinder so that became the new plan. (Red arrows.)

Cut 2

While the now-exposed flat brace inside the Dustbuster body is indeed flat, the front face of the work light body turned out not to be perfectly flat. As a result they didn’t mate flush so we’ll needed adhesive that can bridge small gaps. A search of adhesives already in the workshop nominated the Loctite construction adhesive for the job. While applying the glue, the center had to be avoided since we don’t want to glue the two halves together.

The instruction for the adhesive said to brace the joints with physical force while it cures over 24 hours. So the two parts will be held together with a small clamp while we wait.


(Cross-posted to


Fitting NEXTEC Compartment to Dustbuster Body

We have a Black & Decker BHD9600CHV Dustbuster. We have a useless LED work light that’s a part of the modular NEXTEC lithium-ion battery system. The Dustbuster needs new batteries, so let’s remove the LED and attach its battery compartment to the Dustbuster. This will give the Dustbuster 12V lithium-ion power, a healthy boost over its original 9.6V Ni-Cad power.

Loose fit

We’ve disassembled both devices and can start with some loose test fits for spacing. Here’s an arrangement that removes as little plastic as possible. It keeps most of the Dustbuster handle and attaches the work light body to the end. Physically this design would be very long and has a lot of wasted space. Let’s tighten things up.

Tight Fit

We want to keep the Dustbuster switch, so we’re not willing to cut any forward than that. We don’t care about the work light switch, so we can cut that off. In fact everything is fair game up until the battery connector which we want to keep. Pushing the battery connector plate all the way up against the Dustbuster switch gives us the most compact layout feasible.

This will work from a component layout perspective, but it will be tricky to precisely cut all the pieces to fit. The industrial design of both devices have a lot of curves for us to deal with. However, they both have some flat surfaces we can try to use to make our work easier.

Flats Fit

The Dustbuster has a flat brace just behind the switch. The work light has a flat surface where the battery compartment ends and the swivel LED begins. If we line them up, we should be able to attach the flat surfaces together. There will be more wasted space this way but the reduced fitting headaches should be worth the trade-off.

(Cross-posted to

Disassemble NEXTEC LED Work Light

Today’s project is to disassemble the NEXTEC LED work light and see if we can use it to adapt an old Black & Decker BHD9600CHV Dustbuster to lithium-ion power.

The wish list of the disassembly operation are:

  • Battery compartment: If we could use the battery compartment of the work light, don’t have to reverse engineer the dimensions of the battery pack and the slots needed to clip the battery in place.
  • Battery connector: If we could use the battery connector of the work light, we don’t have to reverse engineer the precise location and dimension of the metal contacts for drawing power from the battery.
  • Battery over-discharge protection: Unlike Ni-Cad batteries’ tolerance of discharge, over-discharging lithium-ion cells could cause permanent damage. As a result, most lithium-ion devices have a protection circuit and I’d like to pull that in.

The things we don’t care about:

  • LED array: There are plenty of LEDs of all color and brightness on every electronic tinkerer’s workbench. One fewer array would not be missed.
  • Switch: The work light’s switch is the type where a press closes the circuit, then another press opens the circuit. This is the right behavior for a light but not for a vacuum. Also: this switch was designed for a low-amperage LED and while it looks sufficiently beefy, it might not tolerate the amperage draw of a Dustbuster motor.

With these goals in mind we start with the obvious task of removing the four visible screws. After the screws were removed there was one more fastener: a small metal C-clip holding the two halves together near where the pinkie finger rests while holding the light. The clip was designed to require a specific tool for a clean removal. For people who are unconcerned about cosmetic damage, it could be persuaded to abandon its post with pliers.

Work Light Disassembled

Looking at the disassembled light, we see we can easily re-purpose the battery compartment and associated battery connector for the project. The third item on the wish list – the over-discharge protection circuit – is unfortunately incorporated onto the LED circuit board and not an easily separated part. We’ll just have to be careful when using the upgraded Dustbuster and not discharge it too much.

Having the battery compartment and electrical contacts is great. It bypasses a lot of iterative CAD work and 3D printing to pin down proper dimensions to fit the battery. The next step is to join the two devices together.

(Cross-posted to

Lithium Batteries for an Old Dustbuster

An old Black & Decker BHD9600CHV Dustbuster has been crippled by its degraded battery. The prime suspect for the degradation is the simple charger unaware it was overcharging the battery pack. We’ve decided to leave behind both the degraded Ni-Cad battery and suspect simple charger. We will replace them with rechargeable lithium-ion batteries.

We have many lithium-ion battery designs to choose from. The different physical form factors are visually obvious, but there are also less visible internal differences. The motivation for these internal differences come from optimization for different usage scenarios. A battery with the wrong usage pattern could result in poor performance, poor battery life, or maybe even fire.

The first candidates are the battery cells extracted from dead laptop battery packs and occasionally used for small electronics projects. These cells were designed to hold a lot of charge then dispense power slowly and evenly over several hours of a laptop’s battery run time. A Dustbuster has a different discharge profile, pulling a lot of power in short bursts. They might not be happy together.

The next candidates are the batteries for remote-control hobbies. RC aircraft and cars are very hard on their battery packs, drawing high amount of power almost constantly over a period of time usually measured in minutes. There were some batteries on hand for small remote-control aircraft, but they could not sustain the amperage draw of the Dustbuster motor. While it is an option to buy some higher-amperage rated battery packs, and they would happily power a Dustbuster, but they are an expensive overkill.

We would prefer something between the above two extremes of the spectrum. Looking around at other lithium battery packs already available, attention settled on a set of cordless power tools powered by 12V lithium battery packs. (Sears Craftsman NEXTEC series.) A handheld vacuum has a power profile very similar to most power tools: short bursts of high power draw. The 12V nominal voltage is higher than the 9.6V of the old battery pack but close enough the motor should be OK as long as used in short bursts. And hopefully the higher voltage gives the vacuum a boost making it even more capable than new.

These cordless tools were purchased in a combination pack, all using the same NEXTEC battery. The LED work light is the least useful member of the pack in this household already full of LEDs. Let’s take it apart and see how we can use it to adapt a Dustbuster to run on the NEXTEC lithium-ion rechargeable battery pack.

Nextec Work Light

(Cross-posted to

Dustbuster Battery: Next Steps

The battery of my old Black & Decker Dustbuster BDH9600CHV is too weak to do its job. Now that we’ve found enough evidence to suggest the battery was degraded by constant over-charging, there are a few options forward: repair, replace, or upgrade.

Cells Removed


The first option is to try to repair the existing battery cells. The information on Wikipedia indicates the cells could be repaired by performing several deep discharge+charge cycles. This must be done on an individual cell basis, because deep discharge of a pack risks irreparable damage to the weaker cells from cell reversal. It would be time-consuming even if the equipment to automate this process is on hand.


The second option is to purchase new Ni-Cad battery cells and replace the degraded ones in the Dustbuster. Ni-Cad batteries are cheap, but assembling them into packs are usually done with the help of a small spot welder. In theory the battery tabs could be attached with a soldering iron, but it’s very difficult to solder a battery cell because the metal can acts as a heat sink drawing heat away from the solder joint. If too much heat goes into the battery cell chemicals, it will damage the battery.

Whether repaired or replaced, the existing power adapter that constantly overcharges the battery pack will need to be retired. What we would need is a good charger with a controller that knows how to properly charge a NiCad battery. Without this knowledge, we’ll quickly return to the same predicament with a battery pack ruined by overcharging.

Usually, when working on a project, it’s fun to buy new tools necessary for the job. Our candidates are:

  • Individual Ni-Cad cell deep discharge+charge cycler.
  • Ni-Cad battery tab spot welder.
  • Ni-Cad aware smart battery charger.

Unfortunately, they’re all dealing with Ni-Cad battery cells, which has faded to niche applications and their use is not expected for future projects. The present (and foreseeable future) solution to portable battery are lithium-ion chemistry cells, and that’s the motivation for the next option:


Since the battery charger would need to be replaced anyway, that removes the main motivation to stay with an electrically compatible chemistry. Freed from that constraint, the most interesting path forward is to find a way to power this old Dustbuster with an entirely different type of battery.

Let’s bring this Dustbuster into the 21-st century with a lithium battery upgrade.

(Cross-posted to

Investigating Dustbuster Battery Degradation

When embarking on a project to repair something, it’s always helpful to understand and articulate what went wrong so we have confidence we’re fixing the right thing. The starting point for this project is seeing this old Black & Decker BDH9600CHV Dustbuster trying to do its job: It couldn’t spin its motors fast enough to generate vacuum to pick up household debris. The most obvious suspect is the battery pack, so let’s examine the batteries.

Dustbuster screws.jpg

Five small screws held the two halves of the vacuum enclosure together. Once the screws were removed, the two halves separated easily without any additional glue or plastic clips to worry about. The internals were as expected – a battery pack, hooked up to a switch, and wired to the motor driving the vacuum vanes.

The battery pack is built from eight nickel-cadmium (Ni-Cad) battery cells. Six arrayed around the motor, and two more tucked in the handle. The first hypothesis is that some of the cells have died. The cell voltage levels were probed as the motor spun, looking for any cells that has sunk to zero volts or possibly a cell-reversal situation. All eight cells delivered under 1 volt but well above zero, disproving the initial “dead cell” hypothesis.

The next hypothesis is battery memory effect. Technically the term applies to a very specific issue with Ni-Cad battery, but in popular use the term has become an umbrella for several different conditions that afflict Ni-Cad batteries.

The most promising item under the umbrella was “Voltage depression due to long-term over-charging”. The voltage has already been verified to be low but not zero. There should be a charging control circuit to prevent over-charging, perhaps that failed? A search came up empty: there didn’t seem to be a charge controller at all. The batteries seemed to be connected directly to the output of the charging stand AC power adapter.

The nominal voltage of this battery pack is 8 * 1.2V = 9.6V. The maximum output of this Dustbuster’s AC to DC adapter? 24V. Ouch! That’s significantly over nominal and the battery pack has been held at that level for years.

These circumstances imply this battery pack has indeed suffered under long-term over-charging. Explaining why it now deliver depressed voltage levels.

24V DC

(Cross-posted to

New Project: Handheld Vacuum Upgrade

Taking a break from reviving old computers, the next project is to revive a small household appliance. The subject of the upgrade is a handheld vacuum. Specifically a Black & Decker BDH9600CHV, a member of the “Dustbuster” line whose success defined a whole new product category.


A major factor of the success is their easy of use. Whenever there’s a cleanup task, it’s easy to pull the vacuum off its charging stand and clean up the mess. No need to pull a big heavy vacuum out of the closet, no need to look for the nearest plug. A small cordless handheld vacuum is very convenient and people are willing to pay for that convenience.

The basic design of a Dustbuster is straightforward: a battery pack hooked up to a motor controlled by a switch. As a result, the majority of the vacuum are durable and reliable thanks to their simplicity. With the notable exception of the battery pack. The battery pack is what makes the cordless vacuum possible and easy to use, but the battery is also the weakest link.

This particular Dustbuster had been sitting in the standby charging base and the battery power capacity gradually dwindled over the past few years. Now the battery pack, even when freshly charged off its charging stand, could only offer a little bit of power before the motor slowed down and couldn’t generate enough vacuum to be useful.

In today’s disposable society, it’s easy to just throw away such a simple and inexpensive appliance and buy a new one. But where’s the fun in that? Since the rest of the vacuum seems to be OK, the goal of the new project is to give this vacuum new life by some combination of repairing, restoring, and/or revamping the battery pack.

Let’s open it up and see what we find…

(Cross-posted to

Supercon 2017 Fun: The Original Luggable PC

I named my Luggable PC project after the original IBM PC clone by Compaq. The Compaq Portable was the computer that started the PC clone market that is still going strong today. It picked up the nickname “luggable PC’ because it was roughly the size and weight of a sewing machine. I’ve seen pictures in books and on web sites, and occasionally I see a unit on display in a museum somewhere. I never expected to see and touch a running unit.

So I was pleasantly surprised (and amazed!) to see one at Hackaday Superconference 2017. It was brought in by Ariane Nazemi, who gave a talk about mechanical keyboards and brought the Compaq as one of his visual aids showing old-school mechanical keyboards. Chatting with Ari I learned one of his hobbies is to restore old computers to running condition. So the original luggable was not just a demonstration piece, it was an actual functional computer.

One of the optional equipment available for the Compaq Portable was a Computer Graphics Adapter. The CGA resolution of 320×200 is has long since been surpassed by modern equipment. But it isn’t very far off from the conference badge camera’s resolution of 128 x 128. And that’s probably why Ari worked to incorporate the Compaq into his badge project. I didn’t want to bother him while he’s focused on getting it to work, but I did ask to take a picture of my Luggable PC sitting next to the original while he worked.


I had looked forward to his project presentation at the end of the conference, but I missed it because I had to take care of some administrative tasks. Alas.

It was great to have these two sit side-by-side and see over thirty years of progress in PC hardware evolution.

(Cross-posted to

Supercon 2017 Fun: Big Screen + Little Screen

I brought my Luggable PC Mark II (Rev B) to the Hackaday Superconference 2017. Its primary purpose was to be my development workstation as I dug into the source code for camera badge hacking. Its secondary purpose was to serve as conversation ice-breaker since the Supercon crowd includes the kind of people who would appreciate it. It accomplished its mission on both fronts!

One fun experience that came out of the weekend was sitting down in the badge hacking area next to the person behind the PaperBack project. He thought it was hilarious that I had the biggest screen on the table and his was the smallest. One discussion led to another and we decided it would be fun to have my computer simultaneously drive its big 24″ screen and his 6″ PaperBack screen.

We had to borrow a DVI to VGA connection from another helpful person in the badge hacking area, and there were some further fiddling with wiring connectors and display settings. (Including several reboots between Ubuntu and Windows since they each provide different ways to customize display parameters.) But eventually we got my Luggable PC to talk to his PaperBack as an external display.

PaperBack closeup

I put our respective project pages on each of the displays. His PaperBack showing his project page, and my Luggable PC screen showing its own project page.

PaperBack and LugPCmkII

This was a completely random project done mostly just to see if it could be done. Exactly the kind of curious exploratory spirit that was pervasive throughout the conference.

(Cross-posted to

Supercon 2017 Badge Film “In the Back Alley”

My Superconference 2017 camera badge project concludes with the 1-minute short “In the Back Alley of Spercon.” I entered it into the short film festival and was ecstatic to have been selected as the winning film!

I recorded a bunch of footage during the day on Saturday, but once the sun went down the camera could no longer record usable footage. So I switched efforts to putting together a presentation of what I’ve recorded. Since the camera badge has no audio capabilities – no microphone nor speaker – it was going to be a silent film by necessity. I followed precedence for silent films, using the text capabilities of the camera badge app framework to put up static text which give context to the moving pictures.

I started with the ambition of writing a short film editing app on the phone, and quickly decided that would take more time than I had. I switched to hard-coding the sequence of text and videos into a single app that I could run on the camera badge. You can still see my original intent in the filename “avitrim.”

Once running, I had something I could show to other people. Friendly curious people had asked about my project in progress Friday and Saturday, and now I could press “Go” to show them the results. Unfortunately that wouldn’t work for the film festival, where they intend to put it up on the big screen. I talked to Hackaday Mike and he suggested I record the badge app in action and put it up on YouTube.

I tried a few different cameras and they all exhibited problems trying to record the footage playing on the OLED screen. Blooming, flickering, and loss of color saturation to various degrees that I struggle to correct with camera settings. The least-bad version came from my cell phone’s camera so that’s the one I uploaded to YouTube.

Playing the YouTube clip on my TV indicated the video was good enough, but the audio was not. I held my breath during the recording so people wouldn’t have to hear my breathing, but the microphone picked up other background sounds. To cover up this annoyance, I went to the YouTube royalty-free music library and picked out a music clip that’s roughly a minute long. It’s not exactly my favorite song but it’s far better than random background noises.

(The project described in this post is documented on and the source code is publicly available on Github.)

Supercon 2017 Badge – Now Recording Time Lapse Video

I arrived at the Supercon badge hacking area Saturday morning and immediately got to work. I picked up where I left off – looking for the place in the code where I can change the frame playback rate to be higher than the 1fps capture rate. Once done, a test run confirmed that the automatic power-off will shut down the camera during a time-lapse so I added a line to reset the powerdowntimer counter during a time-lapse capture.

According to the plan, I should now take what I’ve learned and write a dedicated time-lapse capture app. But as I’m successfully recording time-lapse footage, the motivation to do has dropped drastically. I’d rather walk around and try to record fun footage around the conference. So with that, I’ve abandoned the previously planned “phase 2” and “phase 3”. I’m now more interested in utilizing my time-lapse video capability instead of continuing to invest time refining it. Time is an extremely limited resource on this weekend project!

The badge is not taking full advantage of the sensor, so the lack of resolution and crispness is not a surprise. But since we’re getting so little out of the sensor, we can use all the help we can get. This is why I was both excited and felt sheepish when I realized that I had been filming for half the day with the protective plastic still covering the lens. Removing it didn’t make as much of a difference as I had hoped but hey, every bit counts.

Increase Resolution

Once the sun went down, I stopped shooting footage. There is not enough low-light capability to obtain useful video. Returning to the computer, I started brainstorming the best way to present what I’ve captured. I started trying to write a rudimentary video editor (just to trim frames before and after the parts I wanted to keep) but I had no luck navigating the AVI data structure.

With the ever-ticking clock, I changed tactic: instead of an editor, I’m going to write an app that is hard-coded to play specific video files in order, and a few blocks of text in between. Just like silent films of old. I’m confident this less-ambitious application could be finished by Sunday afternoon.

(The software project discussed in this post is publicly available on Github.)

Supercon 2017 Badge – Software Orientation

With the focus on getting the panning base up and running before Supercon weekend, I haven’t spent as much time as I had wanted on software side. The camera badge source code was released a few weeks ago and were constantly getting updated as the weekend got closer. (Differences between the prototype and production boards, plus other fixes.) I had wanted to keep up to date with the software but my project investigation and the pan base took up all the time I had to spend on this project.

As soon as I had two bases up and running, I went to the early check-in and badge hacking session Friday afternoon. It started at noon and I thought showing up at 3pm would still allow some time to work. I did get some time to work, but I also found that plenty of people arrived before I did and there were no table space remaining.


Oh well. At least I have the badge in hand now. The first thing I did was to perform a quick test. The camera badge came with a video record option, which I intend to dissect for my time-lapse video app. But until then, I could do a real-time video captured while panning on my base to show the basic concept works.

Another bonus of getting the badge in hand is that I was immediately more productive learning the code. The source code was informative, the documentation online was helpful, but my brain needed the anchor of actually seeing the code running. It’s was a great help to play with a menu with my hands, then go back to read the code drawing that menu. The code made a lot more sense after seeing it in action.

I dove into the basic app support framework, and after I understood the basic structure, switched to analyzing the camera app. By the end of the evening I understood enough to know how to modify the camera app to restrict the video recording frame rate to one frame per second. This artificially limited rate much more closely resembles what I would want to do in my time lapse app.

Unfortunately the playback frame rate is “accurate” in the sense it tries to play one frame per second. I have more learning ahead of me before I start writing my own time-lapse app. As a short term workaround, just to see things work with what I have, I copied the file to my computer and used ffmpeg to convert the frame rate of my end-of-evening milestone video.

(The project discussed in this blog post is publicly available on Github)

Supercon 2017 Badge – Pan Base is Turning

After the mechanical bits were assembled yesterday, I worked on the simple PIC program I’d need to drive it. This involved refining the exploratory code into something that resembles an usable device. Things like no longer running on a fixed program but read the potentiometer I wired into the circuit to dictate motor control. Fortunately most of the hard work is done by MPLAB X boilerplate code, I only had to weak a few things here and there to end up with the functionality I want.

(The MPLAB X project file is publicly available on Github.)

I also 3D-printed the remaining layers of the enclosure – the battery tray, a minimalist lid, and the little flexible clips that hold them all together. The layers are an extremely tight fit because the wiring plugs were longer than I expected. Right now they’re pressed against the bottom of the battery tray which is not good for connector health. I’ll increase the height for the next iteration to give everything more headroom.

Pan Base Assembled

The good news is that everything runs. The bad news is that it doesn’t run very well. I dug a digital camera with a built-in time-lapse mode, set it on top of the base, and shot a few clips. The jittery motion of this cheap DIY pan base is very clearly visible in the resulting video. There’s a reason professional photography pan heads cost a lot of money – they have much smoother bearings and better motors for fine control.

Since the conference kicks off tomorrow, I’m going keep forging ahead with what I have. No time to find better motors or bearings. There are a few issues that I might be able to fix in the PIC software, but the sticky jittery motion from the motor and bearing isn’t something I expect to be able to fix in code.

Well, I can hope the jittery motion is not visible in the default 128×96 resolution of the camera!

Supercon 2017 Badge – Pan Base Mechanical Assembly

Hackaday Superconference 2017 kicks off tomorrow! Clock is ticking for me to complete my preparation work. My 3D printer is hard at work churning out iterations of my motorized base for panning photo/video. I had originally intended to drive the whole works with my three-cell lithium lion battery pack built from cells salvaged from a Dell laptop battery pack. The battery power will go straight to the power coils of the stepper motor and a voltage step-down converter will reduce the voltage for the ULN2003 chip driving the steppers and my PIC16F18345 running a program to run the works.

The stepper motor is designed for nominal operating voltage of 5 volts, but the actual limit on stepper motor operation is the amperage running through its coils. I thought I could drive the coils with pulse-width modulation and keep the power under control. The batteries power is about 12 volts, so a 40% duty cycle should be a good approximation.

But real life got in the way of my plan with these unipolar stepper motors. As the coils are energized and de-energized in the PWM cycle, magnetic field and electrical current were getting sent elsewhere in the motor in ways I didn’t understand. Causing the motor to behave erratically instead of just turning at a lower power.

If there wasn’t a looming deadline, I would hit the web searches to learn and understand what’s going on so I could fix the problem correctly. But I do have a deadline and needed a quick fix. “Just” running the motor at full power isn’t a solution. The motor could run at ~12V but it gets very hot. If I was only using the motor to turn infrequently, this might be OK. But a camera pan base is constantly turning slowly.

In order to keep the coils energized with a lower voltage, I changed the power supply to a 4-pack of NiMH AA batteries. Their nominal voltage of 4.8 is close enough for my purposes. It is smaller and lighter than the Li-Ion pack and also eliminates the need for the voltage regulator. The trade-off is a drop in power capacity… which may or may not be important. We don’t know yet. I guess I should pack a NiMH battery charger.

Once the stepper motor power was sorted out, I added a potentiometer to give manual control of rotation direction and speed. Once I finish 3D printing a case around this, I will have a minimal implementation of the mechanical base.

Pan Base Mechanicals

Supercon 2017 Badge – Time Lapse Pan Base

It’s Wednesday and a concrete plan is way overdue if I want to make a project for Supercon 2017 this coming weekend. The badge is a little digital camera so I started thinking about camera accessories that I could build. Since I won’t have the camera itself until Friday, ideally the accessory has some baseline functionality that I can build before I get the badge itself.

There are tons of accessories for photography, but when the goal is to find something both electronic and mechanical, that narrows down the list. Browsing through a photography catalog, I considered a few accessories and settled down on one thing: a pan base. Useful for taking panoramic photos or time-lapse videos, it boils down to a little mechanical platform to turn the camera at a controlled rate as it does its thing.

And most importantly: I can build something basic by this weekend and build upon it through the weekend as time and progress allows. This incremental development means if I don’t get to them all, I’ll still have something neat to show off. This minimizes the risk I’ll get to the end of the weekend and have absolutely nothing to show.

Phase 1: Base Mechnicals

Build the electrical and mechanical parts of the pan base. Digging through the boxes of parts on hand, I think I have everything I need to build the base itself: I have a small slow stepper motor, an associated controller board, a thrust bearing for everything to spin on, and batteries. A PIC with a simple program should be enough to drive the controller board for a slow photography panning motion.

Pan base parts

Hopefully I can get it all put together by Friday, ideally with manual control so it can run by itself.

If this is all I could do, it should be enough to put the camera badge on top and turn on video recording mode for a video that pans across the field of view.

Phase 2: Camera Time-Lapse Mode

If I get the mechanical base working on its own before Friday, it’ll give me time to dive into writing the software for the camera. I’ll need to understand the sample code enough to know what pieces I need to copy/paste to build a time-lapse video app for the camera. Hopefully it’s as simple as taking the video recording application and slowing the frame-rate down.

Once I know the code necessary to gather images and put them in a sequence, I’ll worry about creating the UI to control things like time-lapse speed.

If this is all I could do, it’ll be enough to create cool time-lapse panning video clips to enter into the video contest.

Phase 3: Camera+Base Integration

This is the stretch goal in case everything above was easy and smooth (ha!): Integrate the camera and the base so the time-lapse application controls the panning base. The UI will allow control of not only the frame rate, but also the rotation speed as the time-lapse runs. The camera badge already has a simple API for I2C communication, so I’ll probably have to write code to talk to the PIC controlling the stepper motor via I2C. Either that, or have the PIC32 on board the camera talk to the stepper motor board directly. Whichever is easiest to get running by the end of the weekend.

If I can get this far, I can feel proud at what I have accomplished over Supercon 2017.

Let’s see how far I get. It’s time to get to work!


Supercon 2017 Badge – Pivot for Project Risk Reduction

The calendar does not lie – it is now Tuesday and Superconference starts Friday. After a day of playing with mTouch on the Curiosity board, I’m no closer to a project that captures my fancy. Time to take off the curious explorer hat and put on the project manager hat. (Assuming that it’s not already too late to do so…)

The fact is that I won’t have the camera badge hardware in my hands until Friday. Despite all the help Microchip tries to give us with libraries for doing mTouch, capacitive touch is finicky and will require tuning. On top of having to get oriented with the rest of the hardware. On top of the rest of the conference going on over the weekend. I don’t want to be so consumed by the project that I miss out on interesting things happening.

I’m sure there are hardware hacker types who has accumulated enough skills and experience to put together something in a short time. I have ambition to build up to that skill level, but I have to accept the fact that I’m not there today. And I’m probably not going to get there by the end of the week. Time to change the focus to something more predictable and less risky for the sake of getting something up and running this weekend rather than risk having nothing at all by the end of the weekend.

The new ideals:

  • External components interface with the camera badge in some way to add to the camera badge functionality.
  • External components do not require the camera badge itself for its basic functions, so I can start building it and debugging it before I get the badge Friday.
  • Integration with camera badge to be kept as simple as possible.
  • Integration should not be “none” – it’d be pointless to build something that works just as well without the camera badge.
  • Even if all integration efforts fail (at worst, integration is “none”) I want to have enough to demo the idea even if it doesn’t work.

The above ideas led me to think about building an electro-mechanical camera accessory. The gears in the brain continue turning…. but soon physical gears will turn, too.