Monitoring a voltage without affecting the circuit ? - Page 1
Forum section: electronics / beginners

author: aneng
author_rank: Regular Contributor
timestamp: July 28, 2020, 10:48:20 pm
content: Hi. I want to make a project for my car that involves using an Arduino and monitoring the accelerator pedal position. The accelerator pedal is electrical - it operates a potentiometer that sends a voltage to the ECU. I want to tap that connection and present the voltage to one of the analogue input pins on the Arduino - but - I need to be certain that in doing so I'm not going to affect the voltage reaching the ECU of the car. I cannot risk any unexpected voltage reaching the ECU for obvious reasons.How can I achieve this isolation ? Would a capacitor between the accelerator voltage line and the Arduino input do this ?Thanks!

author: IanB
author_rank: Super Contributor
timestamp: July 28, 2020, 11:08:26 pm
content: Most likely you would want to use a reasonably high value resistor and make sure it is connected to an input terminal with no chance of back-feeding any voltage. But in general, this seems like it would have significant safety implications. What might happen if the Ardiuno got damaged by a power spike and fed a high voltage out of its input? I'm not sure I would contemplate this kind of modification.It would be safer to consider some kind of optical position sensor, perhaps?

author: sokoloff
author_rank: Super Contributor
timestamp: July 29, 2020, 12:03:41 am
content: If you want to read right off the throttle position sensor, I’d probably use an op-amp as a follower.However, if your car is a modern one, you might consider picking the throttle value off the OBD2 CAN bus. That is safer (and quite easy).Look for an MCP2515 interface board.

author: tggzzz
author_rank: Super Contributor
timestamp: July 29, 2020, 12:42:47 am
content: Quote from: IanB on July 28, 2020, 11:08:26 pmYes, exactly that.Other failure modes don't need to invoke damaged Arduinos. Simple interference might screw up the throttle setting, or wires could become disconnected or shorted or be connected to the wrong place.And after the car has failed and caused an accident, the insurance assessor might look and say "dangerous unauthorised modification, therefore your insurance is void". The consequence of that might be a failure of the OP's liquidity, followed by bankruptcy

author: aneng
author_rank: Regular Contributor
timestamp: July 29, 2020, 08:54:28 am
content: I like the OBDII interface idea. Much safer than anything else. I didn't know you could get an interface. Thanks very much everyone.

author: sokoloff
author_rank: Super Contributor
timestamp: July 29, 2020, 11:16:24 am
content: I'll tell you the exact parts I use for a workshop-based tool. They're on the big side, so you can make the production device smaller, but if you want to quickly knock something up in the lab, buy:Full Uno-sized Arduino board (clones are fine).CAN shield - I bought this one:https://www.aliexpress.com/item/32647794351.htmlDB9-OBD2 cable - I bought this one:https://www.aliexpress.com/item/1476212056.htmlAlso very handy in my CAN "poking around" (to learn which CAN messages are which) was the PiCAN2 board and a Raspberry Pi.https://copperhilltech.com/pican-2-can-bus-interface-for-raspberry-pi/Use that and the Linux CAN tools to explore which messages are generated with changing data as you manipulate things in the car.PiCAN board uses the same DB9 cable as above, so consider buying a couple of those cables and maybe an OBD2 Y-cable for testing.You have to solder bridge a couple pads on the PiCAN to select which bus to monitor. It's easy and well documented.

author: sokoloff
author_rank: Super Contributor
timestamp: July 29, 2020, 11:22:06 am
content: Sorry to add even one more thing, but depending on what you're trying to accomplish, you can also buy extremely cheap COTS OBD2->Bluetooth serial or OBD2->Wifi dongles and write a smartphone app if you're just trying to do throttle position data logging or something similar.

author: aneng
author_rank: Regular Contributor
timestamp: July 29, 2020, 03:02:19 pm
content: Thanks very much @sokoloff. I've only dabbled a bit with programming the Arduino so my learning curve may be a bit steep!Was there any documentation with that Canbus shield? I have no idea how to get throttle position data, or indeed ANY data from an OBD2 port. How did you work out how to do it?

author: sokoloff
author_rank: Super Contributor
timestamp: July 29, 2020, 03:29:14 pm
content: I would start by googling your car model and see if someone has already mapped out the CAN traffic.TPS is almost surely an item which is periodically broadcast on the CAN bus, so you don't need to send anything onto the bus to query for it; just find the message ID and relevant bits, set the message ID filter in your code and just watch for the traffic of interest. Plenty of sample code out there and might even be someone has written up a hackaday type post on your particular car. I started years ago with someone else's OBD2 CAN sketch, but I can't seem to find it now.https://github.com/autowp/arduino-mcp2515#set-receive-mask-and-filterIf you need to explore the CAN traffic, I found the PiCAN2 and cansniffer tool to be more productive for exploring/mapping/discovering "where the hell is the throttle position?!" (I checked my old notes and cansniffer was the tool I used to explore 'which message and which bits are which?')To understand the basics of CAN bus, spending 10 minutes readingsomething like thiswill save you an hour later because you'll have the basics a little better understood.If you're more of a video-watching type, this video (which I only skimmed), seems pretty useful and I didn't see anything incorrect. It also has a link to the code (which I didn't go explore).Otherwise, you could start a Projects thread here (with a better title/subject so people can find it) and you'll get plenty of help (including from me as time permits).Good luck!