Close

Prototype Hardware

A project log for Custom Display for Elliptical Trainer

Buy a cheap exercise device, get cheap display. But we can fix this!

mike-szczysMike Szczys 01/26/2017 at 17:560 Comments

Now that I've figured out some of the SPI schema I want to make sure I can automatically harvest and display that data with some add-on hardware.

I have measured the logic levels at 3.3V which is perfect for hardware options I have on hand. I grabbed my trusty ATmega168 which I use for a lot of prototyping. It will run on 3.3V and has hardware SPI which can operate in slave mode and has plenty of IO to hook up a two digit 7-segment display (6940HR).

Firmware Description:

SPI packets are sent out by the elliptical machine every 100ms with a clock rate of 125kHz. The packets are 16 bytes (plus one extra bit but I'm really just ignoring that).

Follow along in main.c code. This is from tagged snapshot (prototype1).

I'm using a hardware interrupt to received each byte but it's important to make sure we know where each packet begins. Because of this, my interrupt sets a flag when it begins to receive data. My main loop watches for this flag and checks for the Chip Select to go high, signaling the end of a packet. The two of these allow the main loop to know when transmission has ended at which point the interrupts are disabled and the received data is processed. Here's the general flow of the program:

The segment decoding in this prototype firmware is extreme. The display has a finite number of states (0-9 and the letter P for 7-segment displays) to a lookup table should be used for subsequent versions of the firmware.

Here's the prototype connected to the elliptical machine. With this proof of concept I can not take the time to reverse engineer the rest of the SPI scheme and then begin work on the final hardware.


7-segment Display Pin Connections:

For verbosity of documentation, here are the connections for this set setup (I'm not planning to make a schematic of this setup):

SPI connections:

Discussions