Saturday, September 23, 2017

Crossing the Great Canadian Electric Vehicle Desert

I recently returned from a three week trip crossing Canada in a Tesla Model S. The journey began in the heart of Silicon Valley and followed the West Coast of the United States until reaching Vancouver. I then travelled east on the Trans-Canada Highway until reaching the Greater Toronto Area where I was born and raised. After spending some quality time with family and catching up with old friends I returned to California on the Tesla Supercharger Network, crossing through the Rocky Mountains of Colorado.

Green: Charging Stops | Red: Rest Stops | Purple: Trip Start/Finish
It was an incredible trip and certainly takes first place for the longest of my road trips. I faced challenges crossing Canada due to the lack of charging infrastructure. With perseverance, resourcefulness and patience I was able to complete the trip without requiring a tow (though I did have a close call in Northern Ontario).

Tesla Model S in Rocky National Park, Colorado
Along the way I met some incredible people. One fellow performed his own EV conversion on an older model Porsche. Another built his own experimental aircraft. I was graciously invited into the home of a Tesla owner in Thunder Bay, Ontario who was happy to lend a charge and share a meal. The trip was enlightening because it was off the beaten path and allowed an opportunity to meet people who live their life just a little differently than the way I live my own.

Driving through the Rockies in Alberta


This trip encompassed 12000km (7400mi) of driving and consumed more than 2.2MWh of energy spread out over 140+ hours of driving. The trip across from Silicon Valley to Toronto took 8 days, 3 of which were spent navigating Northern Ontario. It was an exercise in patience but the prize of being just one of a few drivers to complete this route in an electric vehicle is unequivocally worth it.

Sunday, January 8, 2017

pwrusbctl: A command-line tool for controlling USB-connected power strips

Over the past few days I wrote a command-line tool for controlling and monitoring PowerUSB-branded power strips. These are clever devices that connect to a computer via USB and allow power monitoring and controlling the state of the outlets. I decided to call it pwrusbctl and you can view the code on GitHub.

The company that sells them offer a binary blob driver, but I wanted something that I could extend and modify. I also want it to work with my RaspberryPi.

PowerUSB Basic connected to a RaspberryPi
I used HIDAPI as an abstraction over HID which makes the codebase portable. It has been tested to work on Linux and Mac OS. You can find more documentation in the README on GitHub. Here is an example of the output:
[andrew@andrew-rpi-1 pwrusbctl]$ ./pwrusbctl --reset_charge_accumulator --device_info --log_indefinitely --power --energy --interval 2000000
Found PowerUSB device type: Basic
Power: 32.200001W
Energy: 0.000000kWh
Power: 32.200001W
Energy: 0.000537kWh
Power: 27.599998W
Energy: 0.000537kWh
Power: 27.599998W
Energy: 0.000537kWh
Power: 50.599998W
Energy: 0.000537kWh
Power: 172.500000W
Energy: 0.000537kWh
Power: 342.700012W
Energy: 0.000537kWh
Power: 519.799988W
Energy: 0.000537kWh
Power: 545.099976W
Energy: 0.000537kWh