Author Topic: Frequency detection IC with Serial Interface?  (Read 2491 times)

0 Members and 1 Guest are viewing this topic.

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Frequency detection IC with Serial Interface?
« on: October 13, 2018, 10:33:11 am »
I'm trying to design an expansion board for a RaspberryPi which will include frequency detection. Because the RPi is busy running a full OS I decided that the best solution was have a dedicated chip detect the frequency and then have the RPi read it back. For that I needed a serial interface, of some sort. So I found the LS7366R [1] but I've not been able to source it from a supplier. So having found that one finding a similar alternative is proving quite difficult. Does anybody know of a suitable chip?

[1] https://lsicsi.com/datasheets/LS7366R.pdf
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5875
  • Country: de
Re: Frequency detection IC with Serial Interface?
« Reply #1 on: October 13, 2018, 10:51:18 am »
What exactly do you mean by "frequency detection"? I have problems visualizing how this applies to a quadrature counter.

 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Frequency detection IC with Serial Interface?
« Reply #2 on: October 14, 2018, 07:56:28 pm »
Oops sorry should have been clearer. There's a diagnostic port on a Vehicle I'm faffing about on, one of the pins is a square wave which comes from the alternator. That square wave is proportional to the current engine speed. I was thinking of using a counter to count the pulses over a period of time to calculate the engine speed. A microcontroller, (one of those 3 cent ones would do the trick) but though There might be something generic I could use.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Frequency detection IC with Serial Interface?
« Reply #3 on: October 15, 2018, 08:14:07 am »
You can grab a cheap microcontroller like ATtiny44A, PIC16F72 or STM32F030F4P6 and implement a frequency counter in there.
« Last Edit: October 15, 2018, 08:16:45 am by technix »
 

Offline CJay

  • Super Contributor
  • ***
  • Posts: 4136
  • Country: gb
Re: Frequency detection IC with Serial Interface?
« Reply #4 on: October 15, 2018, 10:52:18 am »
There's a few projects out there which use microcontrollers, but as the speed of the engine will change quite a lot it's going to be difficult to measure a simple frequency as most will have gate times which are too long to be useful in the KHz (at best) range, it's better to measure the period between the pulses and average it over a set amount of time, you need to accept that it's not going to be accurate.

If the vehicle is OBD-2 equipped you may be better served by something like an ELM chip which can connect to the OBD bus and should be able to extract the RPM data from the ECU in real time.

https://en.wikipedia.org/wiki/ELM327

Frequency counters:

http://www.linuxfocus.org/English/September2002/article253.shtml
http://panteltje.com/panteltje/pic/freq_pic/
 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Frequency detection IC with Serial Interface?
« Reply #5 on: October 17, 2018, 10:28:29 am »
I'm afraid there's no OBD on this vehicle :( and I guess there ain't an easy solution. Thanks so much for the links and the help. I'll go and have a look at the parts I have and see if I've a uC that'll do the job.

Thanks again.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Frequency detection IC with Serial Interface?
« Reply #6 on: October 17, 2018, 10:54:15 am »
The signal surely is a few kHz at most, right? A separate chip is fine, but a gpio and interrupts is all you really need to do that. Most of the trouble is going to be proper signal conditioning.
The further a society drifts from truth, the more it will hate those who speak it.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Frequency detection IC with Serial Interface?
« Reply #7 on: October 17, 2018, 11:01:27 am »
Pretty much any microcontroller can do this. Interface to RasPi could be I2C, SPI or UART
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Frequency detection IC with Serial Interface?
« Reply #8 on: October 17, 2018, 11:12:52 am »
Pretty much any microcontroller can do this. Interface to RasPi could be I2C, SPI or UART
That is what I was talking about. It doesn’t even have to be those name brand products like ATtiny44, PIC16F72 or STM32F030F4, those cheapies like STC15W102 (8051-based,) GD32F130F6 (ARM Cortex-M3 based,) and that 3-cent OTP chip would all suffice really well too
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Frequency detection IC with Serial Interface?
« Reply #9 on: October 17, 2018, 11:45:26 am »
RPi max interrupt latency is going to be 500 µs only very rarely, most of the time below 50µs, could filter that out in software easily.

https://medium.com/@metebalci/latency-of-raspberry-pi-3-on-standard-and-real-time-linux-4-9-kernel-2d9c20704495#2b45
« Last Edit: October 17, 2018, 11:47:38 am by GeorgeOfTheJungle »
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Frequency detection IC with Serial Interface?
« Reply #10 on: October 17, 2018, 02:18:24 pm »
I have a PIC16F sitting in a drawer so that's going to be my target device.

I'm glad somebody asked about signal conditioning. The signal is obviously a nominal 12V signal, and yes I'd image a few kHz at most. I was thinking for signal conditioning that the easy answer to that is an Opto coupler to isolate the 12V. I've never used an Opto coupler and not that I think they are difficult or anything but I wonder is there a jelly bean part that a number of manufacturers make and has a standard footprint? That could start a heated debate but thought I'd ask. I suppose if I look at digikey there'll be one that's stocked in huge numbers or something.

On the RPI interface side I'll do an SPI interface or I2C and have the RPi poll for updates. Every second should be more then enough of an update rate for the RPi.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Frequency detection IC with Serial Interface?
« Reply #11 on: October 17, 2018, 02:30:06 pm »
I have a PIC16F sitting in a drawer so that's going to be my target device.

I'm glad somebody asked about signal conditioning. The signal is obviously a nominal 12V signal, and yes I'd image a few kHz at most. I was thinking for signal conditioning that the easy answer to that is an Opto coupler to isolate the 12V. I've never used an Opto coupler and not that I think they are difficult or anything but I wonder is there a jelly bean part that a number of manufacturers make and has a standard footprint? That could start a heated debate but thought I'd ask. I suppose if I look at digikey there'll be one that's stocked in huge numbers or something.

On the RPI interface side I'll do an SPI interface or I2C and have the RPi poll for updates. Every second should be more then enough of an update rate for the RPi.
Depending on how busy the Pi is, you can even throw some more work on the MCU, especially if you also add in an interrupt line from the MCU to the Pi. For example the MCU can monitor the signal and interruptthe Pi if the signal value go out of a certain threshold from the last value the Pi read. Now the Pi can mind its business without polling the signal, and only read the data when the MCU alerts it through that interrupt line.
 

Offline texaspyro

  • Super Contributor
  • ***
  • Posts: 1407
Re: Frequency detection IC with Serial Interface?
« Reply #12 on: October 18, 2018, 05:40:03 am »
Google PICPET.  This is a family of dirt cheap time stamping interval counter chips.  Each pulse in is time stamped and sent out a serial port (sub microsecond resolution).  It can handle inputs up to 100 Hz, so you will probably need a divider on the input... maybe one of his PICDIV chips will be suitable.
 
The following users thanked this post: jwhitmore

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Frequency detection IC with Serial Interface?
« Reply #13 on: October 18, 2018, 11:20:26 am »
Whilst I like your idea, of using interrupts, I think I'll leave it for this iteration. I'm combining both my frequency counter and a CAN Bus module (MCP2515) onto the RPi SPI Interface. The MCP2515 will be connected to the RPi interrupt line so I think I'll make it simple and have the frequency polled. Perhaps you can have two devices on the one RPi interrupt line, I'd have to get into that and do some research. For the moment I'll just poll it.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Frequency detection IC with Serial Interface?
« Reply #14 on: October 18, 2018, 02:04:15 pm »
Whilst I like your idea, of using interrupts, I think I'll leave it for this iteration. I'm combining both my frequency counter and a CAN Bus module (MCP2515) onto the RPi SPI Interface. The MCP2515 will be connected to the RPi interrupt line so I think I'll make it simple and have the frequency polled. Perhaps you can have two devices on the one RPi interrupt line, I'd have to get into that and do some research. For the moment I'll just poll it.
You can have multiple interrupt lines - every GPIO pin on the Pi is individually interruptible. You have two separate GPIO pins for interrupt, and use two separate ISR's for those.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf