Broadcast Engineer at BellMedia, Computer history buff, compulsive deprecated, disparate hardware hoarder, R/C, robots, arduino, RF, and everything in between.
3646 stories
·
3 followers

Bil Herd Asks OBD “How Fast am I Going?”

1 Share

Whenever I end up with a new vehicle I ultimately end up sticking in a new GPS/Receiver combination for better sound quality and a better GPS.

I am quite at home tearing into a dashboard as I was licensed to install CB radios in my teens as well as being the local go-to guy for 8-track stereo upgrades in the 70’s. I have spent a portion of my life laying upside down in a puddle on the car floor peering up into the mess of wires and brackets trying to keep things from dropping on my face. If you remember my post on my Datsun 280ZXT, I laid in that same position while welding in a clutch pedal bracket while getting very little welding slag on my face. I did make a note that the next time I convert a car from an automatic to a manual to do so while things are still disassembled.image15

Swapping out a factory radio usually involves choosing whether to hack into the existing factory wiring wire-by-wire, or my preference, getting a cable harness that mates with the factory plug and making an adapter out of it by splicing it to the connector that comes with the new radio.

Usually I still have to hunt down a few signals such as reverse indicator, parking brake indicator, vehicle speed sensor and the like. In my last vehicle the Vehicle Speed Sensor (VSS) wire was supposed to be in the factory harness, but driving experience showed it must not be as the GPS would show me driving 30 feet to the right of the highway. That and the calibration screen on the GPS verified that it was not receiving speed pulses.

Finding the VSS Wire

Diving deep into the dash verified that a single wire was in fact missing in spite of being shown in the standard Haynes manual. Many times the VSS signal is on the harness for use by a GPS or for the automatic volume adjustment on the radio — as the vehicle goes faster the factory radio gets louder.

speed-pulse

I checked all of my online installer resources and no one had identified the signal as present anywhere in the driver compartment. Finally I leased the Ford schematics directly from Ford and was able to identify a safe speed signal to use. I should note that I stay away from the wheel speed sensors for the anti-lock brake system, I am already freaked out by the thought that a microcontroller is running the brakes on my behalf. As it turns out there was a solitary signal that lets the windshield wiper controller speed up when the vehicle speeds up, like an automatic volume control only for wipers.

All of this effort got me thinking about how else I could have done this without running wires through the firewall and tapping one of 300 wires attached to the on-board Electronic Control Unit (ECU). In other words, how would a normal person do it?

Microchip Technology Incorporated 18060 IVN
Microchip Technology Incorporated 18060 IVN

One thought I had was to put together a dedicated circuit that could query what the vehicle speed was from the built-in On Board Diagnostic bus (OBD or OBDII) and synthesizing a speed pulse from the resulting data. Looking on the Internet briefly I found that there was one company that did this for retrofitting taxicabs for the metering hardware but not much more than that. Besides all of that, I needed a topic for a Hackaday video.

Here we see the years that the various OBD protocols were used and a quick summary.

Name

Speed

Used by

ISO 9141

10 Kbits/second

most Asian and European manufacturers

J1850 PWM

(Pulse Width Modulation)

100 Kbits/second

Ford, Mazda

J1850 VPW

(Variable Pulse Width)

100 Kbits/second

Primarily GM

CAN

(Controller Area Network)

200-500

Kbits/second

Newer Vehicles

Looking into the OBDII connector and protocol the first thing that jumps out is that it’s not a single protocol; it is a collection of legacy protocols. Vehicles made since 2008 typically use the Controller Area Network (CAN) protocol.

obd-years
Microchip Technology Incorporated 18060 IVN

One thing I knew was that I didn’t want to learn the intricacies of these lower level protocols and how to program at a bit or frame level, I just wanted to ask and get an answer to a simple question: “What is the vehicle speed?” In the video I do go into the different electrical interfaces for J1850, ISO9141 and CAN.

Reading CAN Data

I came upon an OBD interpreter chip made by OBD Solutions. It’s called the STN1110 and converts the physical and low level protocols into a simple ASCII based UART interface.

stn1110

Sending a query for the Parameter Identification (PID) for Vehicle speed “010d” results in a three byte response with the third byte being the vehicle speed in kilometers and hour as a single byte hex value. (0-255 km/hr). From this data it’s just a matter of creating a pulse that gets faster based on the size of the VSS value, the larger the value, the higher the output frequency. I actually don’t know what the GPS expects as a normal frequency but being software, I can always scale it if I run into problems.

schematicLooking at the datasheet for the STN1110 they give examples of the interface circuitry for the various protocols: CAN, J1850, ISO9141. If I were doing this project for production I would scrutinize the interfaces in great detail, but for a video and a one-off circuit I am more than willing to take the vendor’s suggested circuits as they most likely know the “normal” for what works.

What the designer still has to do is make sure that surge protection and that the current draw and the ability to “sleep” are designed in. With regard to surge suppression, the automobile is one dirty environment; huge inductors (starter, alternator) and lots of places where spikes and surges can be injected. With regard to current draw, the assembly would be plugged in “permanently” which means that it’s current draw must be minuscule while sitting for weeks on battery power. I once installed an alarm system in one of my cars which killed the battery in a week, it sucked.

Cramming Too Much On One Board Footprint

pcb1

Looking at the board you will see I did an insane thing, I mixed surface mount and through-hole and not just any through-hole, I mounted the resistors radially, meaning that they stand up like the old Japanese radios of the 70s-80s. Part of the idea was what if I wanted to make a kit and the other is that I really hate placing 50 SMT resistors as they get in my arm hair and it’s easy to misplace them. The size of the PCB was selected to fit a plastic enclosure I picked off of Digikey.

Turns out once I got into everything I realize that if I pare the design down to just the CAN protocol (2008+) it will do everything I need and so rev 2 will be all through-hole so I can throw the spares up on Tinde as a kit.

Things work well enough with the final board with the exception of the fact that I missed that one of the LED indicator pins is also used to initiate a Non-Volatile RAM initialization… I mean who doubles an LED pin as an input pin? Even with the LED in place a resistor would be needed to tie it tosimulator a known state since an LED that is turned off doesn’t conduct current or act like a resistor.

Finally at the end of the video I break out my cheapo OBD simulator which basically parks my truck on the work bench, electronically speaking. There are really good versions of these, mine is a $70 one I got off eBay. The instructions are in Mandarin but they really aren’t needed. Using a dev board with built-in USB connector simulates my custom board without the FTDI interaction I was getting between the Hackaday Pro Trinket and serial monitor. I set the baud for 9600 and issue the PID query for VSS: 010D (or $010D as I would say being an old timer)

It replies with B5 meaning that the simulator is traveling at 181 km/hr. (Decimal of Hex B5 is 181)

In the next post I address the software. Being a simple form of instrumentation my inclination is to implement this as a (simple) Real Time Operating System (RTOS) meaning that hardware counters and timers tied to crystal create the final signal that does not vary based on the execution time of the code. I am also inclined to use assembler (did you submit to the Hackaday 1k Challenge??) and because I am a hardware engineer I love true In circuit Emulators(ICE). You know, where you actually see the execution of the processor itself and can set true breakpoints (An IDE is not an ICE). See you next time!


Filed under: car hacks, Featured



Read the whole story
tekvax
3 days ago
reply
Burlington, Ontario
Share this story
Delete

Source tells Motherboard that Apple will testify against Nebraska's "Right to Repair" law

2 Comments

Motherboard says a source told them that "an Apple representative, staffer, or lobbyist will testify" against the state's Right to Repair bill, which requires companies to make it easy for their customers to choose from a variety of repair options, from official channels to third parties to DIY. (more…)

Read the whole story
tekvax
3 days ago
reply
thanks to big brother apple!
Burlington, Ontario
Share this story
Delete
1 public comment
ttroxell
5 days ago
reply
fuckin apple again
San Francisco

Li'l Trump

1 Share

Tiny Trumps is a new subreddit page that features the little fella in his daily life. From Melania making sure he doesn't take a tumble to Obama doing his best not to laugh to Trumpkin entertaining Justin Trudeau, Tiny Trumps is my current go-to when I need a good chuckle.
Read the whole story
tekvax
3 days ago
reply
Burlington, Ontario
Share this story
Delete

The MakeShift Challenge (or what would MacGyver do?)

1 Comment

For its first five years, Make: magazine ran a column called "MakeShift," edited by Lee D. Zlotoff, creator of the TV show MacGyver. The idea was to present Make: readers with a MacGyver-esque challenge in each issue, collect all of the submitted solutions, and then publish an analysis, along with all of the top submitters' notes and sketches, on the Make: website. The "MakeShift" challenge asked readers to ponder such conundrums as how to contain a viral outbreak on a plane, how to charge your phone with nothing but camping gear and a propane torch, how to fend off a zombie attack, and how to get help after a very bad fall.

The reader-responses were impressive. People really put a lot of thought into their solutions, sending copious notes and drawings. And in fully explaining the challenges and ranking the solutions in the follow-up website articles, Lee and Make: editor Bill Lidwell shared a lot of great MacGyvering tips and nutshell science and engineering.

Sadly, years ago, the "MakeShift" columns disappeared when a dedicated magazine area of the Make: site was discontinued. So, a few weeks ago, Make: decided to bring back "MakeShift," now publishing re-constituted columns every Wednesday. Here are the first three posted.

Dead Car Battery

You're 50 miles into mountainous woods, your battery is dead, and there's a big snowstorm bearing down. How can you revive your dead battery? On, and it's a automatic transmission.

Potable Water

You're in a village in East Asia and the water has become dangerously contaminated. You have 48 hours to create a reliable source of potable water. Go!

Crane-Mounting a Fiberglass Super Cow

A realtor wants to mount a giant fiberglass cow, made to look like Superman, on top of a 40-story-tall sky crane, during the summer and fall, in a city that's at high risk of hurricanes. An engineering firm says it will cost some $50,000 to safely deploy the Super Cow. You brag that you could easily do it for $20. The realtor accepts. Now what do you do?

One of the ideas that Lee put forth in the columns was a MacGyver-worthy measure of intelligence that he called MQ (for "MakeShift Quotient"). MQ is one's ability to use knowledge of science and engineering, combined with chewing gum, bailing wire, and some Yankee ingenuity, to fashion workable solutions to problems on the fly. Reading through these challenges, reader solutions, and Lee and Bill's thoughtful commentary, is a surefire way to increase your own MQ.

Disclosure: I have been involved with Make:, in one guise or another, since its inception. I am currently a regular contributor to the website and the magazine.

Read the whole story
tekvax
3 days ago
reply
get out your bubble gum and paperclips out!
Burlington, Ontario
Share this story
Delete

This year's nerd Valentines are in, and they are boss af

1 Share

For the fifth year (previously), Evil Mad Scientist Labs offers a selection of supremely nerdy Valentines to download [PDF] and print! (more…)

Read the whole story
tekvax
6 days ago
reply
Burlington, Ontario
Share this story
Delete

Proof-of-concept ransomware locks up the PLCs that control power plants

1 Share

In Out of Control: Ransomware for Industrial Control Systems, three Georgia Tech computer scientists describe their work to develop LogicLocker, a piece of proof-of-concept ransomware that infects the programmable logic controllers that are used to control industrial systems like those in power plants. (more…)

Read the whole story
tekvax
6 days ago
reply
Burlington, Ontario
Share this story
Delete
Next Page of Stories