Tuesday, February 12, 2019

datvideo: Storing Video on Digital Audio Tape (DAT)

About a year ago I added a Digital Audio Tape (DAT) deck to my home theater system. I was turned onto the format by popular Youtuber and a great video that he produced: . I had wanted to add magnetic tape to my home theater for some time and this highly unique format seemed like a perfect choice.

Big Buck Bunny from DAT Tape
Shortly after purchasing the deck I realized that I could likely store any arbitrary binary data on the tape with the input/output. It would be really cool to merge some modern high-compression video codec with this antiquated format. Over this weekend I decided to do just that.

I wrote a small tool called that allows storing arbitrary binary data on the tape. This tool is used to grab raw audio binary data from a sound card, search for frames of binary data, decode them and emit them into another file. This can be assembled into a pipeline to feed video data into a player such as mplayer. How cool is that?

Sony DTC-690, below Marantz Blu-Ray, AV Receiver and New-Old-Stock DAT Tapes
In this article, I will walk you through how I pulled this off.

Tuesday, December 4, 2018

PortL2 - Portable Electric Vehicle Charger

Over the past year I have been tossing around the idea of extending the electric range of my . I have wanted to build a large scale lithium battery system for some time and this seemed like a great way to learn about the technology.

I had originally started with the idea of charging the ELR hybrid pack while driving. The plan was to use a 48V to 390V (96S) lithium battery charger. Accessing the high voltage bus in the car proved to be challenging and made this approach too difficult for my taste. This made me decide build a portable L2 charger using a 240V inverter and an  instead.

Cadillac ELR Charging at Sierra Trail Head, No L2 Chargers for Miles
I used four battery modules from an old , with a design capacity of more than 2kWh each. The total capacity is around 7kWh now as the cells are several years old and have seen some use. The results so far have been great with the system capable of charging the car to more than 60%.

In addition to being a great portable car charger, this has proven to serve well in powerwall applications. I am able to shift on-peak loads to off-peak, thus saving money and reducing reliance on dirty sources of power.

PortL2 Before Transferring to the Car
I used an to monitor the pack, perform cell balancing and monitor temperatures. The video above has a complete build log and you can find more details in the rest of this article.

Sunday, February 18, 2018

Groking the Cadillac ELR

Those who know me well know that I have a passion for electric vehicles (EVs). I own a Tesla Model S, have driven it across the US and Canada twice, and am currently designing an electric bicycle with design cues taken from larger EVs and based on lessons learned from my electric skateboard project. I really can not scratch the itch to drive and learn more about EVs.

Last fall I purchased a  to keep my Tesla company in the garage. I am a huge fan of this car for the striking good looks and the fact that it is a 2-door coupe. I had also never experienced a PHEV (Plug-In Hybrid Electric Vehicle) and really wanted to try out the GM Voltec platform. The prices of the Cadillac ELR are plummeting due to their relatively short-lived time on the market and the fact that they are a little unknown in the eyes of the average consumer.

Cadillac ELR at Cardinale GMC in Seaside, California
I did not buy this car with the intention of merely letting it sit in the garage though. One of the great features of the Tesla Model S is that it lets you "nerd out" with all kinds of stats about your trip. You get total energy consumption in kWh, efficiency in Wh/mile, range estimates based on change in elevation/speed and a whole lot more that makes driving a true delight.

The Cadillac ELR (and Chevy Volt - they share the same powertrain and a similar UI) tend to shield you from these details. I wanted more and without having to do quick mental math based on the limited information available from the built-in infotainment system.

Speed, Distance, Total Energy and Wh/mi Top | State of Charge (SoC) kWh Left | Speed mph Right
I spent about a week decoding traffic on the CAN bus of the ELR in an effort to find a few signals: speed, state of charge (SoC) in kWh, and odometer or a trip of some sort. Once I found these fields, I built a UI with PyQt to render statistics in real-time.

CAN Bus Interface Cable
I packaged it all up into a neatly organized cable and used a to read data from the CAN buses and visualize it on a small display. Continue reading for more details.

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  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 . 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 .

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

Saturday, December 31, 2016

Extreme Long Range Electric Longboarding: 56km on a Boosted Board

I just returned from a 56km ride. I toured the bike trails along the Upper/Lower Crystal Springs Reservoirs and San Andreas Lake here in the San Francisco Bay Area. This is a new record for me. My previous range record was 27km on a single charge.

Boosted Board with external battery in my backpack :]
To achieve this I used a very large and custom designed lithium-ion battery pack. I tossed it in my backpack and connected it to the Boosted Board where I had previously made a modification to expose the internal battery voltage rail. This pack is arranged in a 10S6P (10-series, 6-parallel) configuration. It has a rated capacity of 21Ah at 37V nominal or roughly 777Wh. The internal battery of the Boosted Board has a rated capacity of 99Wh.

This battery pack is designed to attach to a custom designed board that I have been working on but is not ready for prime time yet. Below is a sneak preview of the board I am working on. I have decided to name it Voyager as one of the design goals has been to prioritize range.

10S6P battery mounted to Voyager with custom charging cable attached
Continue reading to learn more about my new record and construction of this battery pack. There are also more pictures of Voyager at the bottom of this post.

Sunday, November 6, 2016

ichargermon: a Linux/Mac iCharger monitoring tool

I use an to charge a few batteries for my electric skateboard. I also top up the battery in my car from time to time. I thought it would be nice to keep track of the charging progress so I wrote a small tool to parse logs that are output over UART and format them into a human-readable format.

I named the tool . Feel free to send a pull request!

The project is written in C/C++ and has no external dependencies at this time. If I decide to support more advanced iChargers I will add libusb as a dependency.

Charging a small 3S1P battery pack
I also have an that I would like to add support for. The 4010Duo implements a much more rich protocol (MODBUS) that supports both remote monitoring and control.

Anyway, for now here is an example of the output. Thanks for reading!
Input voltage:    15.163V
Battery voltage:  40.165V
Battery amps:     0.990A
Internal temp:    30.300C
Cell 0 voltage:   4.009V
Cell 1 voltage:   4.010V
Cell 2 voltage:   4.012V
Cell 3 voltage:   3.998V
Cell 4 voltage:   4.014V
Cell 5 voltage:   4.014V
Cell 6 voltage:   4.014V
Cell 7 voltage:   4.014V
Cell 8 voltage:   4.017V
Cell 9 voltage:   4.019V

Thursday, February 11, 2016

VGA Generation with Freescale i.MX23 + Linux

I have long wanted to become more well acquainted with the Linux kernel and finally decided to bite the bullet. I ordered an from to tinker with. The Freescale i.MX23 processor is noteworthy because it is available in an LQFP-128 package which means it can be installed on a PCB by hand with inexpensive tools and a steady hand. It is also a great platform to learn with because it is well supported by the upstream kernel and has documentation available without signing an NDA.

The first thing I did was modify the device tree (DTS files) to enable the LCD controller and tuned it to generate a VGA signal. I built a simple R/R2 DAC on a breadboard and was able to view the image on an LCD monitor.

The projected image next to my workstation
All of this was completed under Arch Linux ARM which provides a minimal base image and root filesystem upon which a large number of packages have been ported to run on ARM. This has been a great learning experience and I plan to continue working with this chip more.

Hackaday, it doesn't quite like the 640 width
Continue reading to see the very minor changes I made to the kernel and how I wired it  all up.

Tuesday, January 26, 2016

MikMod on STM32F4

Over the past couple of days I have ported to run on an STM32F407. This is a very memory constrained environment with only 128kB of RAM but I am able to play some rather complex MOD and XM files that are in the range of 60kB in size. I had to patch libmikmod slightly and write a new audio output driver to make all of this happen.

MikMod on STM32F4 Hardware :]
The audio quality is quite good. I currently have MikMod configured to render at 44.1kHz in mono. I could likely render in stereo but I would be limited to smaller MOD and XM files due to the increased memory usage. Here is a video that mainly shows the audio quality as captured by my camera.

The video below contains a little more technical detail, demonstration of boot and loading different audio files.

Monday, November 9, 2015

Long Range Electric Longboarding

I bought a back in August of this year while living in New York City. It was an awesome purchase. It is fun to ride and I could often beat the subway to my destination on shorter trips. I have since moved to Silicon Valley and find the range to be lacking slightly. The board gets approximately 7 miles of range out of the box and my office is 10 miles from home.

My Boosted Board shortly after purchase.
I added 288Wh of high-discharge lithium-ion batteries to the 99Wh of batteries that came with the board. I was inspired by the  Youtube Channel.  During the first test ride I was able to ride more than 13 miles before stopping. The fuel gauge on the remote showed more than 20% of battery remaining.

My Boosted Board after the battery upgrade :]
During this process I also designed a custom lighting system based on WS2812 LEDs and an Arduino Mini Pro.

These LEDs are bright!

Sunday, November 23, 2014

Flir Lepton Thermal Imaging Sensor + Gameduino 2

I recently got my hands on a pair of thermal imaging sensors and have spent the last week bringing them online in my spare time. These are absolutely incredible devices that I believe will pave the way to consumer devices incorporating thermal imaging cameras. The footprint of the camera module (and optical assembly) is about the size of a dime. The resolution is 80x60 at 14bpp which is remarkable despite sounding low.

Thermal Andrew :]
I have successfully implemented a driver for the Lepton module and displayed frames on an LCD. This is all running on an STM32F4 processor on a . Attached to it is a which incorporates the graphics processor. I have implemented my own colorization and min/max scaling before uploading the frames to the GPU.

Front System Overview
I have used some simple jumper wires to interface with this camera. This setup is running at 21MHz with no issues. I am using a provided by . You can pick up one from if you are interested. The Lepton module can be ripped out the for now.

Rear System Overview and Second Camera (future project ;])
I wrote my own driver for the Lepton core and the FT800 graphics processor. Continue reading for more details!

Thursday, May 15, 2014

FT800 with Streaming Video

I like to check out the thrift stores in my area for one of a kind technical gems to add to my collection. A few years ago I came across a . This is one of the earliest webcams that didn't require a separate video capture card. Due to how easy it was to install, it was incredibly popular. So much so that Logitech ended up buying Connectix out and forking the product under their own brand.

Connectix QuickCam
When I saw it in the store I really had no idea what it was aside from the fact that it was a webcam and it had a parallel port. My first instinct was that a parallel port is simply a collection of TTL lines that I could emulate with a modern microcontroller. I finally had some time to put it into action and decided to stream video frames from the camera to a  and the video processor that it uses.

The results were great, aside from the low image quality of the camera. This experiment proves the concept of using an FT800 to composite motion video with other visual elements. A better image sensor would provide a really cool experience.

Keep reading to see how I did it!

Monday, April 21, 2014

2048, Embedded

Let me first get something out of the way... I am an embedded nut. I absolutely love taking a foreign piece of hardware and bringing it to life. My most recent excursion into embedded land has been with a board designed by .

I decided to pair this board with a  shield designed for the popular . I wrote a driver for the  graphics processor and implemented   game as a first project with this hardware.

2048 Screenshot
The result is an awesome device that emulates the fun 2048 browser game (pretty closely, anyway). It will make a great desk ornament for passersby at work to gawk at.

Nucleo F4 Board
In this article I will give you a demonstration of the game and take you through some of the design concepts I have used to come up with this product. I wrote my own linker script, C-Runtime and driver library for this project and it was an awesome experience.

Wednesday, March 12, 2014

Happy 25th Birthday to the World Wide Web

I remember my family's first computer well. It was 1997 and I was an easily-excited 6-year-old boy. This rather large contraption just landed on my dining room table and needless to say, I was very curious. I remember playing with my Dad. I remember being amazed when we purchased our TV Tuner video card. We could somehow watch cable television on our PC... while browsing the web! What a wonder!

Google's Homepage on March 12th, 2014
Today marks the 25th anniversary of the creation of the web. Google has included a small homage to the beginning of the web that we know and love today on their homepage.

I decided to install Netscape Navigator to see how it stands up against the modern web. This is running on Linux Mint 16, a derivative of the popular Ubuntu. Needless to say, the results are not great. Thanks to the concept of graceful-degradation though, most of the content is still highly-usable despite being arranged a little oddly.

http://ksbldkn.cn in Netscape Navigator on Linux Mint 16
I tried to load a few websites that I frequent to see how well they are displayed. Read on to see more!

Thursday, January 30, 2014

Vacuum Fluorescent Display Alarm Clock

I have been working on this fun little project for the last couple of days. I ordered this VFD display from  as a free sample. I am quite grateful for their generosity and I decided to put this display to good use.

I have written a driver in C# that implements a partial selection of the commands available from this display. The driver is object-oriented with property accessors used to set configuration parameters of the display.

Weather Data, Emails and a Loader Animation :]
I put all of this together into a sample application for a smart alarm clock that I would like to build eventually. The sample application gets my unread e-mail from Gmail and weather data from . I am also attacking the 16 custom characters that reside in ram to display a few simple animations.

Thursday, January 2, 2014

Snow Day: Conky Configuration Time!

It is quite snowy in southern Ontario today so I spent a bit of time configuring Conky on my system. I have heard of conky before but never bothered to put any time into configuring it.

For those of you who don't know, Conky is a nice system monitoring application that runs on the root X window. This means that it sits on your desktop like Active Desktop, but better.

Mine looks good, but I have seen screenshots of some very artistic configurations.

Conky Configuration :]
Read more to see my conky.conf file!

Wednesday, January 1, 2014

3D Perspective Projection

I have wanted to write a 3D rendering engine for years and I have finally decided to spend some time on the problem. I decided to implement a simplistic rendering engine that supports the following basic features:
  • 3D Perspective Projection (far objects are smaller than near objects)
  • Triangular Polygons for Rendering
  • Simplistic Lighting Model
  • Colored Polygon Faces (no texturing)
The largest hurdle for me was getting past perspective projection. I did some research about matrix transformations and got caught up quite deeply in mathematical abstraction. It was the image below that really set my mind in motion. I decided to take a step back and use some simple high school trigonometry to solve the problem.

Leon Battista Alberti and Perspective Projection
I have spent approximately 13 hours on this project and the results so far are fantastic looking. This entire experiment has given me great insights into the way 3D geometry is rendered onto a 2D plane.

The Classic Utah Teapot :]
In this article I will show you the various steps that I have taken to render this image. I will focus on the mathematics behind perspective projection that I used to arrive at the teapot rendering above. The image is not perfect, but I am happy with the results.

Saturday, December 21, 2013

Dealing With a Stubborn Laptop Battery

I own an older model Panasonic Toughbook CF-28. I picked it up a couple of years ago for around a hundred dollars or so. It has a Pentium III 800MHz processor and 512MB of RAM, nothing to phone home about. What it lacks in performance it makes up for in its' rugged design. It is a military specification laptop that is capable of withstanding short drops, extreme temperatures and light water splashes. It also has a touchscreen. In other words, it is a fun toy.

This laptop was missing the battery when I acquired it. I decided to opt for a cheap replacement available on eBay for around fifty dollars. When the battery arrived, I was quite pleased with the quality and performance of the product. I was easily able to get more than 5 hours of battery runtime out of the laptop.

This laptop is far from my daily driver and I left it on the shelf for a few months. When I came back to it the battery was expectedly discharged completely. The interesting part is that it would not accept a charge despite the charge indicator being illuminated.

I decided to disassemble the battery to investigate and was able to bring it back to life!

Fixed Battery

Friday, December 6, 2013

A Graphical Introduction to Hash Functions with SHA-2

Bitcoin Logo
Cryptography is the glue that holds together our modern society of electronic banking, web authentication mechanisms and identity verification. It is also the basis for the radical shifts in the way we think about our money such as .

I have been fascinated by the concepts of cryptography lately and decided to implement a cryptographic hashing function to try and better understand them. I will present the knowledge that I have gained in an easy to understand fashion. I am by no means an expert on this subject but if you have a general interest this should be a good starting point.

I have decided to implement SHA-256 due to the widespread adoption and ubiquity of this particular function. This implementation is designed in LabVIEW which is a graphical programming language. Whether you are a seasoned programmer or just interested in cryptography, this gentle introduction will be beneficial to you.

Wednesday, December 4, 2013

A Testament to X11 Backwards Compatibility

I recently scored a Hewlett Packard 1670A Deep Memory Logic Analyzer and I finally had a chance to fire it up. This unit dates back to 1992 and is packed with all sorts of interesting options for connecting peripherals to it. One particular feature that caught my eye was the option to connect to an X Server.

HP 1670A Logic Analyzer
Here is the interface of the logic analyzer running on a remote X connection. I enjoy the colour scheme.

HP 1670A user interface over an X connection :]
I will give you a quick explanation as to how I was able to set this up by modifying a couple of configuration files to enable remote X connections.
乐优彩票登入,备用,官方网址 乐优彩票网址是多少 乐优炫彩app 乐优彩票天天红单下载 乐信pc群新人送38 乐博28app下载 乐优炫彩app下载 乐优炫彩app天天红单 乐博app下载 乐体育app下载