Go Down

### Topic: Reading pulses from another circuit (Read 721 times)previous topic - next topic

#### nlscarter

##### Jan 26, 2013, 02:38 pm
So, I'm trying make a shift light for my 1992 BMW.  Looking on the BMW forums, I can get to my tacho wire (not OBDII car is too old).  First off I'm just trying to get pulseIn (or alternative) to work.
I have my Nano with a simple bit of code to provide a pulse that my Uno can read.
pin10 high, delay(100), pin10 low, delay(duration) - duration controlled by a potentiometer on the Nano.
So I'm treating pin10 as the cable i find in the car, I can hopefully calibrate later once i get it functioning.

Not had much luck with pulseIn function and I'm a bit confused about what my wiring should look like. I wonder if anyone can help.

I tried the pulseIn tutorial, (not a lot of info on the page)  also found a nice bit code that could replace pulseIN
{
pulseBegin = millis();
pulseDuration = millis()-pulseBegin;
Serial.println(pulseDuration);
}

My wiring tried just bridging output pin 10 on nano to input pin on the uno, but i don't get any change in the serial reading when i tweek the nano potentiometer.

I always think with my electrical brain rather than electronics, what I'd like to wire up is the equivalent of;
The nano/car signal drives a relay coil, then the uno has +5v going to the power side of the relay and a digital-in pin from the NO contact.

I'm beggining to dable with transistors and it feels like I should use one here, but don't quite know how to read by 4 pin relay concept to the 3 pins on the transistor.

Hope this makes sense!

Many thanks
Neal

#### dc42

#1
##### Jan 26, 2013, 05:27 pm
If you are looking for a 4-pin equivalent of a relay in that situation, use an opto isolator instead of a transistor (with a resistor in series with the input).

BTW the usual way to measure the interval of a regular input signal is to feed it into a pin that supports attachInterrupt, attach a service routine using mode RISING or FALLING, and time the interval between interrupts.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### dhenry

#2
##### Jan 27, 2013, 01:59 am
Quote
I can get to my tacho wire

You will need to get a sense of what types of signals you are dealing with. My guess is that it is a pwm signal - most tachos are like that.

In that case, you will need to measure duty cycle + period.

It can be a one-timer or two-timer solution, depending on how you want to solve it.

#### nlscarter

#3
##### Feb 13, 2013, 10:31 am
Trying the opto isolator solution this evening. Thanks guys.

Go Up

Please enter a valid email to subscribe