I’m trying to read incoming data from my motorcycle’s K-line, which is a bi-directional serial line.
I found an individual who had done this very thing, so I basically followed almost exactly what he did, with a few adjustments:
The bike communicates with a 12v signal, and he used a special chip to convert that data to 5v so the Arduino would like it. (L9637) I tried to order a similar chip, but I was not working for me.
I ended up using a Zener clipping circuit into a schmitt trigger (74HC14) to create the 5v output to send to the Arduino. The problem is it actually works…only some of the time. At first I thought I had messed up the circuit between tests, so I took a picture of it the last time it was working. The circuit is simple enough that I don’t think I am ‘breaking’ it.
I attached 4 images:
- what I get from the serial monitor when things are working correctly
- what I get from the serial monitor currently, plus the code
- a drawing of my circuit
- a crappy photo of my breadboard
I’m sure this could be a number of things. I have an oscilloscope that has shown me a few things. The signal from the bike is solid. I can see the square wave perfectly. The clipping circuit seems to be working properly, however when I hook power or ground from the arduino into the circuit, there seems to be a sine wave of noise that ‘adds’ itself to the square serial signal. I am teaching myself electrical theory from the ground up, so when it comes to electron flow and where I should be grounding things I may not have the best ideas for circuits.