Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samie/tacho
Python script to drive a tachometer on Raspberry Pi GPIO using PWM. Show CPU, network traffic, or MQTT data.
https://github.com/samie/tacho
mqtt python raspberry-pi tachometer
Last synced: 21 days ago
JSON representation
Python script to drive a tachometer on Raspberry Pi GPIO using PWM. Show CPU, network traffic, or MQTT data.
- Host: GitHub
- URL: https://github.com/samie/tacho
- Owner: samie
- License: apache-2.0
- Created: 2015-01-14T07:23:27.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-17T17:18:08.000Z (over 9 years ago)
- Last Synced: 2023-03-14T09:15:30.625Z (over 1 year ago)
- Topics: mqtt, python, raspberry-pi, tachometer
- Language: Python
- Homepage:
- Size: 262 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tacho
Python script to drive a tachometer on Raspberry Pi GPIO using PWM![Screenshot](/tacho-network.jpg?raw=true "Network traffic MB/s")
## Required hardware and schematics
The components needed to drive a standard automotive RPM gauge are
pretty simple. You need:- 12V power source (or battery) for the gauge
- Optocoupler 4N25 to separate the gauge signal and Raspberry Pi GPIO.
- 75 (or so) Ohm resistor for optocoupler input
- 20kOhm resistor for pull-down for gauge signal line (might depend on gauge)The script assumes BCM GPIO 4 (Pin 7 in Rasperry Pi) to be used for
driving the gauge. Pin 9 is used for the ground. Opto-isolator acts like
normal led, so putting a small ~75 Ohm resistor makes it ok with 3.3V.The Hz is calibrated to [specific hardware](http://biltema.se/sv/Bil---MC/Bil-tillbehor/Bil-el/Instrument/Varvraknare-32251/) using the calibration array in the beginning of the script. You probably need to adjust the numbers
here to make it match your hardware. Mine had huge variations especially between 4 to 6.## Operating modes
Run the script by giving the operating more as the first parameter:
- test - Goes trhough test cycle setting values from 1 to 8
- [value] - displays the given float value between 1-8
- cpu - displays CPU load percentage from 0 up to 80%
- network - displays network inbound traffic in MB/s.
- mqtt [server] [topic] - subscribes to MQTT broker / topic for values.Optional 'quiet' parameter disables the console output.
For example the following puts the script to refresh CPU on the background
sudo ./tacho.py cpu quiet &
Note, that because GPIO on RPi needs root access 'sudo' must be used.