Hacking "Chinese" parking sensors

Hello,

I am at the moment half-toying with one of those cheap "Chinese" parking sensor kits. The kind that can be had for about $15 from eBay.

There are tutorials on the Internet how to hack into the serial connection between the control unit and a display, see for example here:

http://www.underwaterrov.net/hacking-reverse-parking-sensors-with-an-arduino

http://hardware-rebirth.blogspot.de/2013/07/hacking-chinese-parking-assist-digging.html

However, my idea/goal is to try to get the parking sensors to work without the supplied control unit, i.e. connect them straight to the Arduino and get distance data from it.

Here's how I have rigged it up so far:

(I have replaced the horribly loud beeper with an LED, so my neighbors won't be annoyed)

On the back of it, I have soldered wires onto the connections for one of the sensors:

For testing purposes, I have also mounted all four sensors on a piece of plywood that faces up towards the celing:

After trying to get a reading with XOscillo didn't work, I had the idea of trying to get something via serial. And indeed, using the following sketch on an Arduino Uno board...

int incomingByte = 0;

void setup() {
        Serial.begin(250000);   
}

void loop() {

        //checking serial connection for data
        if (Serial.available() > 0) {
                // reading incoming byte:
                incomingByte = Serial.read();

                // Output received data
                Serial.print("Received: (BIN / DEC): \t\t\t");                
                Serial.print(incomingByte, BIN);
                Serial.print("\t\t\t");
                Serial.println(incomingByte, DEC);
        }
}

... I am getting readings on the RX pin when connecting the red soldered-on wire to it:

Received: 		BIN			DEC
			10011111			159
			11111111			255
			10011111			159
			11111111			255
			11111			31
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10111110			190
			11111111			255
			10011111			159
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			11110			30
			11110			30
			10011110			158
			10011110			158
			11110			30
			11111110			254
			11011111			223
			11011111			223
			11011111			223
			11011111			223
			10011110			158
			11011111			223
			11110			30
			10011100			156
			10011110			158
			10011110			158
			11100			28
			11100			28
			11100			28
			11100			28
			11100			28
			11100			28
			11111100			252
			10111110			190
			11001111			207
			11011111			223
			11011111			223
			11011111			223
			11011111			223
			11001111			207
			11001111			207
			11001111			207
			10011110			158
			11111110			254
			10111111			191
			11011111			223
			10111111			191
			11111111			255
			10011111			159
			11111111			255
			10111111			191
			11111111			255
			11111			31
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			11111110			254
			10011111			159
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			11110			30
			10011110			158
			10011110			158
			11111110			254
			11011111			223
			11011111			223
			11011111			223
			11111111			255
			10011110			158
			11001111			207
			11111			31
			10011110			158
			10011110			158
			11110			30
			11110			30
			11100			28
			11100			28
			11100			28
			11100			28
			11100			28
			11111100			252
			10011111			159
			11011111			223
			11011111			223
			11011111			223
			11011111			223
			11011111			223
			11001111			207
			11001111			207
			11001111			207
			10001111			143
			11111110			254
			10111110			190
			11011111			223
			10111110			190
			11111111			255
			10011111			159
			11111111			255
			10111111			191
			11111111			255
			11111			31
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10111110			190
			11111110			254
			10011111			159
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			10011110			158
			11110			30
			11110			30
			10011110			158
			10011110			158
			11111100			252
			11011111			223
			11011111			223
			11011111			223
			11011111			223
			10011110			158
			11111111			255

Nothing on the black wire though when I connect it to RX.

I am trying to make sense of this data. At the moment, the module seems to give out error beeps when it is connected to the Arduino's serial pin. My guess is that the Arduino draws too much current away from the communication between sensor and circuit board. Waving my hand over the sensor also at the moment doesn't seem to have any effect on what I read via serial.

So is this data just random noise, or do you guys have any idea what this points to in terms of maybe getting the sensor to work directly with an Arduino?

I've also tried connecting the sensor to the Arduino, and tried to send a 50 kHz burst to it to get it to respond, as one of the above tutorials implies. But that didn't work so far.

Any thoughts?

Hi. These sensors use a single transducer for both sending and receiving so there is a minimum distance of 20 cm or so...

This type sensor is also available with a separate small board for the electronics like THESE

Those can be run with the NewPing Arduino Library..

These sensors need some significant electronics to generate the ultrasonic output signal and receive the echo.

terryking228:
Hi. These sensors use a single transducer for both sending and receiving so there is a minimum distance of 20 cm or so...

So I guess somehow that's what I picked up on the Arduino's serial pin?

terryking228:
These sensors need some significant electronics to generate the ultrasonic output signal and receive the echo.

So that means you can't emulate/recreate that with just an Arduino?

I just looked at my serial data again, and there doesn't seem to be any real pattern in it. The bytes oscillate quite wildly between about 30 and 255.

So that means you can't emulate/recreate that with just an Arduino?

Yes I believe that is true...

So what do you make of this then, from the second link above:

My plan is to write my own distance calculations and protocol (if needed). I've figured out the following:

Pin 14 (PB5) is the 50kHz burst to drive the pulse to the ultrasonic senders
Pin 13 (PB6) is where the echo's are received. There is an op amp which means the echo pulses appear as +5V pulses.
Pins 1 (PB4) & 2 (PB3) are the timing information to select each sensor.
Pin 10 (PB0) is the serial data pin to the display and timing source.

I intend to use the existing protocol to tell me which sensor is active and tap into pin 13 and calculate the distance information myself.

Pins 1 and 2 count in binary to control an analogue multiplexer. The basic design is the micro-controller creates a 50kHz burst (20 cycles) and the analogue multiplex routes it to the correct sensor (transmit). The ultrasonic burst travels at the speed of sound (roughly 340m/s) and bounces off objects back to the sensor which has switched to a microphone and listens for the echo. Typical distances for parking are 1.6m. We don't really need much longer than that. So the distance travelled is 1.6m to the object and 1.6m back which is 3.2metres. The longest we need to listen for is 10ms.

I will be going to an electronics store in a bit which is just around the corner from here. Among others, they have the Texas Instruments CD4052BE DIP-16 multiplexer/demultiplexer in stock, according to their web site.

Would that be worth a shot? Unlike the eight channel multiplexer "4051" which is featured in the "Arduino Playground" section, this is a four channel one.

They also have op amps like the Fairchild LM324N there.

Important: don't use hardware serial port for BOTH PC and sensor data. This will not work; you will need softwareserial.h unless you have a mega with multiple UART ports.

So I've just spent an hour or two trying to get the parking sensor to work independently, using an Arduino Uno, a Texas Instruments CD4052B multiplexer, and a Fairchild LM324 op amp.

Here's my schematic, click on image for larger view:

I wanted to start with just one sensor, for a "proof of concept".

And here's my Arduino sketch:

#include <avr/interrupt.h>

#define burst 4
#define echo 5

boolean burstSent = false;
volatile boolean echoSent = false;
unsigned long burstTime = 0;
volatile unsigned long echoMicros = 0;

void setup() {

  pinMode(burst, OUTPUT);
  pinMode(echo, INPUT);
  Serial.begin(250000);

  // Setting Interrupt Registers

  PCICR |= 0b00000100;    // turn on port D
  PCMSK0 |= 0b00100000;    // turn on interrupt on pin PD5
}

void loop() {

  if (!burstSent) {
    noInterrupts();
    burstTime = micros();
    tone(burst, 50000);
    delayMicroseconds(1);
    noTone(burst);
    interrupts();
    burstSent = true;
    Serial.println("Burst sent.");
  }

  if (echoSent) {
    unsigned long microsDifference = echoMicros - burstTime;
    Serial.print("Time delay (microseconds):\t\t");
    Serial.println(microsDifference);
    burstSent = false;
    echoSent = false;
  }
}
ISR (PCINT2_vect) {

  if (PIND & 1 << echo) {
    echoMicros = micros();
    echoSent = true;
  }
}

So far, this does nothing. It was a shot in the dark just throwing this together, because I've got a big electronics store just around the corner and they had these parts in stock for less than 50 cents each.

I was trying to follow the observations in the quote in my last post, but so far, again, nada.

Any thoughts?

I personally bought one of these ultrasonic transducer and plan on rewiring it to one of these commonly found HC-SR04 ultrasonic boards for about a buck or 2

Info about the board: https://uglyduck.ath.cx/ep/archive/2014/01/Making_a_better_HC_SR04_Echo_Locator.html

There's 4x LM324 opamp, a MAX232 and a uC

I've had another look at the parking sensor control module, and it appears much too intricate to be able to recreate its functionality with just a multiplexer and an op amp.

Then again, with the control module, I really already have what would otherwise be called a complete breakout board. IF I am going to turn this into another Arduino project for my second car, for which I bought these sensors in the first place, then I am going to just tap into the control module's speaker line. I toyed with trying to read the module's serial input today, but didn't manage to make it work.

I have developed a finished and already installed Attiny45-based muting device for my daily driver car, which switches the radio to mute when you go into reverse and keeps the car in sustained mute for 30 seconds after you have gone back out of reverse. Also, the mute deactivates itself when you go forward at more than 12 mph, or when you wiggle the radio's volume control knob. The idea is to ensure that you can hear the car's factory parking sensors beeping when you are maneuvering. And to add a little convenience by tapping into the car's speed signal and the radio volume knob.

I could build another circuit like this for my second car, and add an input connection for the speaker line. The speaker line on the sensors control module sadly only gives out a +5V signal, so the supplied beeper isn't a regular speaker, but it is fixed to a certain frequency which it emits when it gets +5V. So I would have to feed the speaker wire into a pin change interrupt on the Attiny45.

Here's a schematic of my radio muting device that is already in existence (click on image for larger view):

However, there are no free pins on my Attiny45 as it is now. The only thing I could do is use pin 5 as PCINT, but as this is the chip's reset pin, this is probably not advised, is it?

no thoughts, anybody? :frowning:

Is using the reset pin on the Attiny as a PCINT pin a good or a bad idea for my design?

carguy:
Hello,

I am at the moment half-toying with one of those cheap "Chinese" parking sensor kits. The kind that can be had for about $15 from eBay.

....

Any thoughts?

I know this is an old post, but to help other people out that may be looking at the same unit as I have, I have found the following.

The one I have been using is a very generic looking 4 sensor unit marked TKOOFN.

These aren't really using a normal async serial stream. At least in the case of the one I have been experimenting with, it does this:

Send a low start pulse of around 32000 usec.

Send a high pulse of around 2000 usec.

Send a low pulse of around 1000 usec.

Send a high pulse of around 100 usec.

It then sends 32 bits of data. Around 100 usec of a high pulse is a zero. Around 200 usec of a high pulse is a 1. (It could be the reverse, but it just means the binary data is inverted)

The 32 bits represent 8 bits for each of the four sensors. Every stream of 32 bits contains distance info for all 4 sensors.

The monitor/LED display does not need to be connected for the control module to send the data, so you can run this connected to the Arduino without using the LED display or trying to emulate it.

I haven't converted the binary value for each sensor to a distance unit, but I suspect its relatively simple.

djaolnes2:
I know this is an old post, but to help other people out that may be looking at the same unit as I have, I have found the following.

The one I have been using is a very generic looking 4 sensor unit marked TKOOFN.

These aren't really using a normal async serial stream. At least in the case of the one I have been experimenting with, it does this:

Send a low start pulse of around 32000 usec.

Send a high pulse of around 2000 usec.

Send a low pulse of around 1000 usec.

Send a high pulse of around 100 usec.

It then sends 32 bits of data. Around 100 usec of a high pulse is a zero. Around 200 usec of a high pulse is a 1. (It could be the reverse, but it just means the binary data is inverted)

The 32 bits represent 8 bits for each of the four sensors. Every stream of 32 bits contains distance info for all 4 sensors.

The monitor/LED display does not need to be connected for the control module to send the data, so you can run this connected to the Arduino without using the LED display or trying to emulate it.

I haven't converted the binary value for each sensor to a distance unit, but I suspect its relatively simple.

what methods did you follow?? Like the circuit parts or connections made between sensors and Arduino........ Can you please share some snaps related to this or give me an overview of your method??