Saturday, July 26, 2014

-----
This project is a good beginner Arduino project. I wanted a digital timer in my gym that counted up from 00 to 60 seconds and reset. Since I had a spare Arduino Nano and a dual 7-segment display (rescued from a guitar effect pedal) I decided to build my own instead of driving to Wal-Mart.
-----
If you are not interested in the details and just want to see the result, check out the video below. If you watch more than the first 10-15 seconds then you should seriously consider getting a hobby. ;)

-----
The dual 7-segment display pinout looks like this. The Arduino Nano has 14 digital outputs and you will need them all. Note: You will have to disconnect D0 and D1 from the dual 7-segment display to get reliable program uploads to the Arduino because these pins double as the USB data connection to your PC.

Not the best documentation, but hook up is pretty straight forward. Each segment is labeled 'A' through 'G' with a "t" suffix for 'tens place' and an 'o' suffix for 'ones place'. Next to each of the 14 labeled segments is the digital pin on the Arduino that that segment is connected to; D0 through D13.
-----
And here is the code. Total project including wiring took a bit over two hours and I am a slow coder.
/*
**************************************
***** www.WhiskeyTangoHotel.Com *****
**************************************
Project Name: Gym Counter Timer

Start Date: July 26, 2014

Program Rev History and Notes:
Simple timer to count up 60 secs then reset.
LEDS are active LOW. Low turns the segment on.
LEDS came from old Zoom guitar effects pedal.

// Function subroutines below to turn on and off the 7-segments
// "_ones" is for the ONES place in the counter. "_tens" is for TENS place in the counter
void zero_ones() {
// segments a b c d e
digitalWrite(a_ones, 0);
digitalWrite(b_ones, 0);
digitalWrite(c_ones, 0);
digitalWrite(d_ones, 0);
digitalWrite(e_ones, 0);
digitalWrite(f_ones, 0);
} //zero_ones

Saturday, July 5, 2014

For a microcontroller the Ardunio Nano is used to digitize the signal from the bike's ECM instead of a PICAXE 18M2.

The gear position output is displayed on a Tektronix MDO3000 oscilloscope instead of a two dollar seven segment LED. The MDO3000 is an amazing instrument from Tektronix; read about it here.

This is probably the only oscilloscope based motorcycle GPI on the planet. It is also perhaps the most impractical and expensive way to build a motorcycle GPI but that was really the entire point of the project. ;)

-----

For those that are not interested in the project details and just want to see the result take a look at this 60 second video:

-----

Basically, here is what is going on.... Analog input A1 on the Arduino microcontroller is configured as a ADC pin and monitors an output on the bike's ECM. See the yellow wire in the video? That is patched into a signal on the ECM that outputs a value of 0-5VDC depending on the gear that the bike is in.

We digitize that ECM voltage on the yellow wire and depending on the voltage of that signal (what gear the bike is in) branch to code that Pulse Width Modulates (PWM) two Arduino digital output (digital output Pin 6 and 5, see code below). Pin 6 and Pin 5 of the Arduino are connected to Channel 1 and Channel 2 of the Tek MDO3000. The scope is put into XY Display mode. Then like "magic" you have the world's most impractical motorcycle gear position indicator ever constructed!

----

Like most of my projects this could not have been accomplished without the help of those much smarter than me posting examples and inspiration on the web. I tried to credit them in my source code comments. In the unlikely event you duplicate this project, please try to give credit where credit is due.

----

Source code is below. I'm a hacker, not a SW Engineer. Plus, I cobbled the code together in a few hours. I know the code can be better written (much better written).