Page 1 of 1

Tachometer

Posted: Wed Apr 22, 2015 4:03 pm
by Rtroonsalas
Hello I'm very new to the Raspberry Pi world. I am part of the auto shop at my high school where we are building a electric motorcycle. We want a tachometer for the motor which will measure the shaft RPM of the motor. I've been looking in to hall effect sensors and they seem to be the easiest to implement. I would like to use the stock tach on the instrument cluster ideally. I came here because we all ready have a raspberry pi sitting around and I would like to use it to look at the signal form the hall effect sensor and convert that into a constant output voltage going to the gauge which varies based on the number of signals form the sensor.

Thanks for your time
Richard Troon-Salas

Re: Tachometer

Posted: Wed Apr 22, 2015 4:55 pm
by joan
What sort of revs are you talking about, in particular how many pulses per second?

The Pi doesn't have any analogue outputs (or inputs) so you'll need a DAC for the varying output voltage (perhaps I2C or SPI based).

Re: Tachometer

Posted: Thu Apr 23, 2015 4:12 pm
by Rtroonsalas
were looking at anywhere form 500 rpm - 5000 rpm. The pulses per second should mirror the RPM/60 so for 5000 RPM the pulses per second would be approximately 84 pulses per second

thanks

Re: Tachometer

Posted: Thu Apr 23, 2015 4:54 pm
by joan
Rtroonsalas wrote:were looking at anywhere form 500 rpm - 5000 rpm. The pulses per second should mirror the RPM/60 so for 5000 RPM the pulses per second would be approximately 84 pulses per second

thanks
The Pi will have no problem with that.

viewtopic.php?p=632413#p632413 shows Python reading about 900 pulses per second each from a pair of Hall Effect devices.

Re: Tachometer

Posted: Fri Apr 24, 2015 3:25 pm
by Rtroonsalas
New problem with this project. Our DC to DC converter outputs 13.5V 22.2Amps. What can I use to step this down to voltage and amperage usable by the raspberry pi B+.

Thanks

Re: Tachometer

Posted: Fri Apr 24, 2015 3:36 pm
by joan
Rtroonsalas wrote:New problem with this project. Our DC to DC converter outputs 13.5V 22.2Amps. What can I use to step this down to voltage and amperage usable by the raspberry pi B+.

Thanks
To power the Pi?

I just use UBECs which cost a GBP or two. They convert anything in the range 5.5V - 26V to 5V typically at 3-4 amps, more than enough for the Pi.

Re: Tachometer

Posted: Fri Apr 24, 2015 3:53 pm
by Rtroonsalas
joan wrote:
Rtroonsalas wrote:New problem with this project. Our DC to DC converter outputs 13.5V 22.2Amps. What can I use to step this down to voltage and amperage usable by the raspberry pi B+.

Thanks
To power the Pi?

I just use UBECs which cost a GBP or two. They convert anything in the range 5.5V - 26V to 5V typically at 3-4 amps, more than enough for the Pi.
a UBEC can handle 22.2 amps?

Re: Tachometer

Posted: Fri Apr 24, 2015 4:08 pm
by joan
Rtroonsalas wrote: ...
a UBEC can handle 22.2 amps?
Not the ones I buy, but neither can the Pi.

What do you plan to power from this 22 amps? 10 Pis?

Re: Tachometer

Posted: Mon May 04, 2015 4:10 pm
by Rtroonsalas
here are the specs of the DC to DC
input voltage form out batteries is 76.8V total pack voltage

output voltage is 13.5v at 300 watts

I need to power both the raspberry pi and a DAC.

Re: Tachometer

Posted: Mon May 04, 2015 4:17 pm
by joan
Rtroonsalas wrote:here are the specs of the DC to DC
input voltage form out batteries is 76.8V total pack voltage

output voltage is 13.5v at 300 watts

I need to power both the raspberry pi and a DAC.
That means the output voltage is 13.5 volts and can supply up to 300 watts (22.2 amps * 13.5V = 300 watts).

Just because it can supply that much doesn't mean it always does. If you put a battery in a torch you don't get a single bright flash. The bulb, as a consequence of its resistance, draws what it needs from the battery to stay bright for a long time.

Similarly if you power a UBEC from that power supply.

Re: Tachometer

Posted: Mon May 04, 2015 6:14 pm
by Rtroonsalas
Thanks for clearing that up! That puts sop many peaces of the puzzle in place.

Re: Tachometer

Posted: Thu Dec 31, 2015 4:54 am
by 1965mustangV8
I am working on a similar project and I was hoping for a little more information.

My plan is to add modern diagnostics to a 1965 Ford Mustang. I want to gather temperatures(water temp, tire/brake temp), tire pressure data, Speed/elevation(and if there is any feasible way of having information on G force like Nissan GTR's do, that would be cool), and RPM's. I want to display this information live on a monitor in the most graphical way possible.

I have some experience with python, css, and html. I generally have no idea how to do this though.

I'm concerned that even if I can figure out how to overcome these task individually that I won't be able to collect it and display it with an RPi. My plan was to run everything from the gpio pins but I don't think there are enough pins.

I mainly am inquiring about the tachometer though. I believe that normal car tachometer run off of the ignition coil. I suppose this works by detecting a pulse. How can I run this into the rpi and how would I decipher the I formation into RPM?

Thanks! Sorry for the huge question, I would appreciate any help I can get on any of this project because I'm pretty much just learning as I go.

Re: Tachometer

Posted: Thu Dec 31, 2015 5:01 am
by 1965mustangV8
I was also hoping to measure fuel flow and speed to come up with an average mpg output.

Re: Tachometer

Posted: Sat Jan 02, 2016 3:00 am
by eagleman
this reply moved to Ford SBF thread.

Re: Tachometer

Posted: Sat Jan 02, 2016 4:02 am
by 1965mustangV8
eagleman wrote:I am working on just such a monitor for the PI2 and a 7" touch screen. I have most of the software running on simulated inputs right now: but I designed a board that was fabricated in China 3 days ago and is enroute to me here in Virginia, It should be here Monday, Jan. 7th. Upon arrival, the board will be populated and carefully tested before being hooked to my newly rebuilt (and yet unstarted) 1964 Ford 289 CID engine.... how about that? My board includes a forty pin input at the car for monitoring various 12VDC inputs for digital input and 12 channels of analog input to a 16 channel ADC feeding the PI thru an SPI format. The other 4 channels are used to measure the 12vdc level, temp of the 5v regulator on my board, and 2 channels of exhaust oxygen sensors. The oxygen sensors measure air/fuel mixture using 2 APSX modules that plug into my board and control the Bosch sensors thru 2 additional 5 pin connectors. The display is easily formatted using Python 3.5 and Pygame. Current display format has 8 analog gauges, 2 sliding pointers for O2 sensors, and 7 indicator lights to monitor low 12vdc, headlights, highbeams, 2 brake malfunction circuits, board temp alarm, low fuel level of just about any analog or digital input with your own simple definable parameter color like a yellow fuel warning at 1/8th tank that turns to a red warning at the "damned low" fuel level. The software is working with a breadboard version of the hardware and simulated inputs until the new board is assembled and tested. There is even stable a 10VDC regulator (required by my original gauges) and a 5vdc regulator to power the boards 5vdc requirements and some additional 5vdc powered sensors for oil temp, fuel pressure, MAP, and a separate coolant temp system. I'd be glad to share and would gladly accept any suggestions for improvement. NOTE: The distributor on the 289 is a billet small block Ford unit with a GM HEI (high energy ignition) as used for electronic ignition on mid 80s GM products. The distributor has not been tested, but expect to pick off it's tach signal for RPM to be as accurate as the timing circuits (poor) will allow it to be. Let me know if you would be interested. This is not a "make for profit" project so any costs would be minimal and a collaboration could greatly improve the project results.
Wow. That's awesome. Sounds like the same idea I have, with a few adjustments(particularly the exhaust oxygen sensors for fuel mixture data!) . You've written the python programs to run this?

Re: Tachometer

Posted: Sat Jan 02, 2016 6:59 am
by eagleman
This reply moved to Ford SBF thread

Re: Tachometer

Posted: Sat Jan 02, 2016 7:21 am
by eagleman
this reply moved to Ford SBF thread

Re: Tachometer

Posted: Sat Jan 02, 2016 7:56 am
by eagleman
For a regulated 5vdc you can use any 7805 chip with an output of up to 1.5 amps and a few filtering capacitors and feed the 13.5vdc thru a power resistor to cut down on heat being generated inside the 7805. The 7805 is a standard regulator in several packages. Just look up "7805" on www.mouser.com and select the voltage regulator. There are a ton of them for just pennies. Freight will cost more than the cost of A quantity of 10. I am trying out a chip unused by me before for a 5vdc regulator. It is a "R78e" and it claims an input voltage tolerance of up to 28vdc with no excess heat. So far I've only run it on a breadboard with a 9volt battery and a load to parallel the PIs 5vdc supply. It has run until the batteries go dead with no problems or excess heat It also shares the pad design for the 7805 so they are interchangeable. Both can plug diectly into the common breadboard.

Re: Tachometer

Posted: Sat Jan 02, 2016 8:22 am
by eagleman
I also suggest getting a readily available 7" TFT touchscreen like the new PI offering. They are also available on eBay for cheap with up to 1200 x 800 resolution with HDMI and USB I/o built into the panel for power and touch interface. With that and a PI and a little Python and Pygame you will be amazed to find out what human interfaces you can design into your project. Don't be afraid of Python 3.5 or Pygame. They are extremely simple to use for output to the screen in raw form or impressive gauge or digital readouts. You can save a ton of time by outputting and inputting your info to a touchscreen... Plus you'll dazzle the onlookers with a professional looking display that is VERY easy to set up. Just don't limit yourself by trying to enter your new software thru the PI keyboard and 7" screen. Use the "TightVNC " software for your desktop to RPi interface for code writing and design work. Both the desktop and RPi must be on the same network and you can code programs inside the RPi from your big screen, keyboard and mouse on the desktop. Minor software corrections inside the RPi memory take only seconds using TightVNC.

Re: Tachometer

Posted: Sat Jan 02, 2016 8:46 am
by eagleman
My apologies to the "tachometer" thread for inadvertently HiJacking the thread for Ford V8 dialog. I didn't realize what I had done. I started a new thread for the Ford SBF and will copy the unrelated info to that thread.
My apologies, again.
eagleman

Re: Tachometer

Posted: Tue Mar 06, 2018 9:54 pm
by charleslinquist
I would also like to use a Raspberry pi as a tachometer - and more.

My project consists of:

1. Monitoring RPM of an engine. The tachometer output will come from a Hall-Effect sensor mounted on the flywheel. The output pulse from the Hall sensor will be very narrow (about 4 degrees of rotation), so at 7000 RPM the pulses will be about 8.5mSec apart, but will be only about 85 microseconds wide. I think this will require a hardware interrupt.

2. Monitoring the pulse width of 4 separate sensors with at least 8 bit accuracy. The pulse width coming from the sensors will be 1000 -2000 microseconds. The repetition rate of each of the 4 sensors will be 50Hz. All of these four inputs are asynchronous to each other.

3. Producing an output pulse width of 1000-2000 microseconds at 20 times a second. The accuracy of the pulse width needs to have at least 8 bit accuracy, and the repetition rate of this output is also 50Hz (20 mSec).

I currently have the above running in a Microchip PIC processor. But I need more capabilities than the PIC can provide. I'm not that familiar with the timers and interrupt structure of a Raspberry pi (3), so before I dig into it more, I would like to ask:

IS WHAT I AM TRYING TO ACCOMPLISH WITH A RASPBERRY PI EVEN POSSIBLE? Do I need a RTOS?

Re: Tachometer

Posted: Tue Mar 06, 2018 10:05 pm
by joan
charleslinquist wrote:
Tue Mar 06, 2018 9:54 pm
...
IS WHAT I AM TRYING TO ACCOMPLISH WITH A RASPBERRY PI EVEN POSSIBLE? Do I need a RTOS?
No need to shout.

My pigpio should do what you want from Python or C.

http://abyz.me.uk/rpi/pigpio/

Re: Tachometer

Posted: Thu Mar 08, 2018 5:05 pm
by eagleman
I'm surprised that you are migrating from a PIC to Raspberry Pi. The Pi in Python and Pygame (maybe a better GUI?). I am migrating from the RaspberryPi (Python) to a combination of PIC (either PIC32MZ2048EFM100 or PIC18F67K40) and a Microsoft Surface Pro 4 via blue tooth.
The cons I had with the PI are:
1. Linux backed PI has too much background processing to read the tach timing (I'm using output of a Aluminum Billet distributor made for the small block Ford, but with a head for GM HEI ignition). I could not get the timing routine in the PI to be reliable because of the background Linux interrupts.
2. Touchscreens of a decent size and resolution get expensive.

I have moved my PI Python program to Python on a PC (could be anything from an old laptop(screen resolution 800x600) to a Microsoft Surface Pro 4 (screen resolution 2736x1824) to just be used as a blue tooth front end. The real processing(ADC, timing and monitoring of on/off) is to be done on a newer PIC. I've been trying to use a PIC32MZ2048EFM100 with it's 100 pins to pride 40 ADC channels , 9 timers, ethernet capability, and all of the other available functions running at 200MHz, but the support needed to run a PIC32MZ is unbelievable and the Microchip support is confusing and lacking and requires "C" programming. I started on the PIC32 programming last October after developing the Windows side in Python and the PIC32MZ has been kicking my butt with virtually no progress. In the last week I decided to drop back to a PIC18F67K40 and the familiar PicBasic Pro. The PIC18F67K40 runs at 60Mhz with a simple internal oscillator, 47 ADC channels, 5 timers, etc., and much simpler programming.
All of my efforts use a specially designed circuit board to accept input signals, voltage divide for a max input of 20 volts down to a PIC friendly 3.3 VDC. On the board used with the PI there was a 16 channel ADC, some timing considerations and monitoring other 12v signals to be passed directly to the PI on the GPIO header. On the board used with the PIC there is the same voltage divider but directly feeding the analog, digital monitoring and timing directly to the PIC for faster and better processing and ultimately transmitting the desired data to the PC via an HC05 bluetooth module plugged into the board. The HC05 Bluetooth module is extremely cheap , acts just like a RS232 interface (simple "serin" and "serout" commands in the PIC) and it provides complete isolation from voltages between auto signal voltages and the PC except maybe for 12v power.
If you are only looking to read a tach, then a simple PIC and an HC05 blue tooth to a PC, Phablet, Pad, or cellphone would be just fine without having to spoend a lot of time, trouble and expense, especially since you have PIC experience. You could also buy an inexpensive LCD from someplace like CrystalFontz or SeeTron (about $40) with a single serial signal wire from the PIC to the LCD. That would make the project self contained with no blue tooth or wire connections
needed to another device. Keep in mind also that you can design your own 100mm x 100mm circuit board at www.easyeda.com and have it fabbed for $9 plus maybe $16 dollars in shipping (for 10 boards). I just designed and ordered 10 boards to adapt the PIC18F67K40 to plug into a standard wide breadboard for development and testing. The board is costing me $33.87 for 27 boards delivered to me within a week and I've ordered another board with it to take advantage of shipping costs being paid.
Let me know if there is anything I can do to help you with software, circuit design or plain old dumb questions. JUST DON'T let your project get out of hand like I did. I am monitoring just about everything on a 52 year old car including computer control of some auto functions, and adding an O2 sensor system for both exhausts.

Re: Tachometer

Posted: Fri Mar 09, 2018 5:21 pm
by eagleman
Just found out that a PIC18F67K40 development board is made by MikRoe and is available at most outlets like Arrow, Mouser, Digikey as MikRoe #2584 for $39.00. It includes everything to start programming immediately and has a bootloader and sample software.