Latest PedalPC Improvements - Variable Power Output, New Case, New Server, And More

Published on 2021-04-10 by Jim Gregory
reading time: ~7 minutes

PedalPC desktop with heated beverage cup
You can now heat your favorite beverage using the PedalPC while you work.

I made four improvements to the PedalPC over the last year. They are:

  1. New pulse-width modulation option on 12V DC power sockets and fan, for improved power management;
  2. New web server, for easier upgrades;
  3. New 3D-printed case with integrated phone shelf, to improve the PedalPC's appearance and functionality; and
  4. Re-designed control board, to add more power ports and make it easier to re-flash the firmware.

Read below to learn more about them, as well as others I hope to implement later.

Pulse Width Modulation (PWM)

The first and perhaps most significant improvement is a PWM option on all the 12 V DC power sockets. To explain what this means and why it's so significant, I need to first explain the problem it solves.

The PedalPC normally generates more electricity than your equipment (computer or laptop, monitor, phones, AA battery charger, etc) consumes. The surplus electricity recharges the PedalPC's storage battery. As the battery charges, it's voltage rises. When the voltage gets too high, the PedalPC's overload relay disconnects the generator to prevent damage to the battery or your equipment.

When this occurs, you have three options:

  1. Pedal more slowly, so you don't generate any surplus electricity;
  2. Stop pedaling, and let your equipment draw down the electricity stored in the battery; or
  3. Plug in more equipment to absorb the generator's surplus.

The first option is the least feasible. It requires pedaling at just the right cadence to balance the generator's output with your equipment's power consumption.

The second option allows you to continue working, but reduces the electricity available for use at other times of the day. It also reduces the amount you can exercise.

The third option allows you to continue working on your computer without discharging the storage battery. It also allows you to exercise longer. The problem is finding equipment that consumes just the right amount of electricity.

The ideal solution would be a variable load you could adjust to "soak up" the generator's excess output. But, most digital devices--computers, phones, monitors, etc--can't be varied this way. A computer, for instance, won't function if you cut the power supplied to it in half.

Two loads that can be varied are fans and heaters. A beverage cup heater (shown in the image at the top of this post) is a particularly good load for a human-powered generator. It can sink a large amount of energy that would otherwise be wasted into warming your coffee, tea, milk, or soup.

The only problem is, a beverage cup heater power consumption normally can't be adjusted. It turns fully on when heating, and off after it reaches its setpoint temperature. (Some cups have a variable temperature setting, but this only adjusts the setpoint temperature, not the rate at which the cup is heated.)

One way to vary its power consumption is rapidly cycle the heater's current on and off during its heating phase, then adjust the period the current is on each cycle. The longer the on period each cycle, the greater the energy sent to the cup. This technique is known as pulse width modulation, and is how you can now manage your surplus power output on the PedalPC.

The new PWM mode is available on all four of the PedalPC's 12 V DC power sockets, plus the cooling fan. To use PWM, select the "%" option on the PedalPC's dashboard, then move the slider to adjust the duty cycle (the fraction of the cycle the heater is switched on).

Below is a screencast loop demonstrating how it works:

PWM control screen capture
Controlling a cup heater in the PedalPC's dashboard. Note how the heater cup's power consumption (highlighted in blue in this demo) increases and the battery (highlighted in red) decreases after PWM is turned on and its duty cycle increased.

Note that you likely won't be able to generate sufficient heat to make coffee or tea, just keep it warm. Making coffee or tea requires significantly more energy.

As I noted above, the PWM function should be used to regulate power only on heaters or fans, not computers, monitors, modems, and similar equipment. Digital devices like these are unlikely to work properly at anything less than 100% duty cycle.

New Web Server

The second improvement I made was replacing the PedalPC's Orange Pi PC Plus web server with a Raspberry Pi 3B+.

raspberry pi 3b
the Raspberry Pi 3B+ single-board computer (source: raspberry pi foundation)

I made this change because upgrading the Orange Pi's operating system without breaking needed wifi functions proved to be too difficult.

The Orange Pi needs a custom wifi driver to enable using it as a wifi repeater or software access point. (These features are used when setting up the PedalPC, and afterwards if you want another wifi access point on your network.) I created a custom driver to enable these functions.

However, each time a software update included a new kernel, the update process copied the new kernel's driver over my custom driver, breaking the functions I added.

I tried to fix this problem by loading the driver as a dynamic kernel module (DKMS), the standard method in Linux for handling a custom hardware driver. But, my custom driver rarely compiled using a new kernel without additional modifications to the driver source code, so I abandoned this approach.

The Raspberry Pi 3B wifi driver natively supports wifi repeater and soft AP functionality, making wifi driver compilations unnecessary. It is also a more popular board, so getting support for it will be easier.

New Case

The third improvement was a new 3D-printed case for the electronics. The old sheet plastic case was a little crude. The web server was attached to the outside using velcro. A pair of DuPont cables connected it to the control board inside.

old orange pi pc plus web server on mounted on back of PedalPC
the previous Orange Pi web server mounted on the outside rear case

The new rear case cover encloses both the web server and control board. The GPIO pins on the web server now plug directly into a socket on the board, making cables unnecessary.

new rear case cover encloses both the control board and new Raspberry Pi web server

The front case cover now has an integrated phone charging shelf that can hold up to two phones. This saves desktop space, and makes viewing and responding to notifications while working easier.

phone charging on the phone shelf
front case cover with new phone shelf

The front, top, and rear of the case are mesh for improved heat dissipation.

New Control Board

The final improvement is a re-designed control board. The new board has two more power output terminals, each supplying power to two USB sockets. This doubles the number of the PedalPC's USB power sockets from 4 to 8.

top view of PCB
new control board

The new control board also fixes a bug that made it impossible to re-flash the microcontroller firmware without removing the microcontroller from the board. This bug made it very difficult to design and test the PWM function; in fact, it's the primary reason I redesigned the board.

Future Improvements

While I am satisfied with the PedalPC's current performance, I would like to make a few more changes.

The first is to break up data acquisition and reporting into separate processes. One application (the web server) currently handles both tasks. I would like to decouple these tasks using MQTT, so you can share your data with other applications you may use like Home Assistant, Fitbit, or your own personal custom dashboard.

I would also like to move the PedalPC application into a Docker container. This would safely isolate it from the rest of the operating system, and make it easier to install other containerized applications like Pi-hole or Nextcloud beside it. My goal is to make it easy to self-host your own personal, self-powered cloud, independent of both the major data providers (Google, Apple, Facebook, etc) and the electricity grid.

The final change I would like to make is rectify the generator's AC output to DC using active rectifiers instead of Schottky diodes. These diodes are the greatest source of power loss in the PedalPC (about 15%, by my estimation). Reducing this power loss would reduce the pedaling needed each day to power all your equipment.

The first two changes should be the easiest to make, as no hardware changes are necessary. A software update could apply these changes to existing machines.

The last change, however, will be more difficult. I'm just starting to research how to effectively implement this without degrading the PedalPC's reliability.

I will post more about these changes as I attempt to implement them. Stay tuned!