Both sides previous revision Previous revision Next revision | Previous revision |
blog:car_stuff_pycosworth_hardware [2021/08/18 18:24] – [Software Configuration] john | blog:car_stuff_pycosworth_hardware [2021/08/18 19:05] (current) – [Making a Gauge Pod] john |
---|
//Note: None of the examples here are necessary if you only intend to use PyCosworth on a laptop using the basic USB to serial cable connected to your ECU.// | //Note: None of the examples here are necessary if you only intend to use PyCosworth on a laptop using the basic USB to serial cable connected to your ECU.// |
| |
===== Connecting an OLED Screen ===== | ===== Connecting an SPI-based OLED Screen ===== |
| |
| TBC |
| |
| ===== Connecting an I2C-based OLED Screen ===== |
| |
You can use PyCosworth without any display functions, but.... it would be //pretty limited//. Here's how you connect up a relatively standard OLED display when using PyCosworth on a Raspberry Pi. | You can use PyCosworth without any display functions, but.... it would be //pretty limited//. Here's how you connect up a relatively standard OLED display when using PyCosworth on a Raspberry Pi. |
</code> | </code> |
| |
| //Note: if the power/ignition is restored before the countdown timer expires, the shutdown will be cancelled and PyCosworth will go back to normal operation. This is especially handy if you have your car in the garage for work, or for fault finding and are stopping and starting the engine regularly.// |
==== Other Considerations ==== | ==== Other Considerations ==== |
| |
'luma_driver' : None, | 'luma_driver' : None, |
'screen_refreshTime' : 0.02, | 'screen_refreshTime' : 0.02, |
'i2cPort' : 0, # Replace this with the I2C bus you are connecting to. This is the default for Pi pins #03 & #05 | 'i2cPort' : 0, # Replace this with the I2C bus you are connecting to. This is when using the normally 'hidden' I2C bus 0 on a Pi with pins #27 and #28 |
'i2cAddress' : 0x3c, # Replace this with the device ID of your OLED module as returned by i2cdetect | 'i2cAddress' : 0x3c, # Replace this with the device ID of your OLED module as returned by i2cdetect |
'mode' : [GFX_MODE_NUMERIC], | 'mode' : [GFX_MODE_NUMERIC], |
| |
{{:blog:pycosworth:img20210818132836.jpg?400|}} {{:blog:pycosworth:img20210818132851.jpg?400|}} {{:blog:pycosworth:img20210818133548.jpg?400|}} | {{:blog:pycosworth:img20210818132836.jpg?400|}} {{:blog:pycosworth:img20210818132851.jpg?400|}} {{:blog:pycosworth:img20210818133548.jpg?400|}} |
| |
| Painted and with buttons and screen fitted: |
| |
| {{:blog:pycosworth:img20210818182938.jpg?500|}} {{:blog:pycosworth:img20210818190355.jpg?500|}} |
| |
=== Connections === | === Connections === |
| |
Remember to change your PyCosworth //libs/settings.py// configuration to set the correct i2c bus and device number, just as you would do on a Pi: | Remember to change your PyCosworth //libs/settings.py// configuration to set the correct i2c bus and device number, just as you would do on a Pi: |
| |
| <code> |
| GFX_MASTER_WINDOW = { |
| 'windowName' : 'Master', |
| 'oledType' : 'sh1106', # Replace this with the model number of your OLED module |
| 'width' : GFX_MASTER_SIZE[0], |
| 'height' : GFX_MASTER_SIZE[1], |
| 'spiAddress' : 0, |
| 'value_refreshTime' : 0.05, |
| 'sdl_framebuffer' : None, |
| 'luma_framebuffer' : None, |
| 'luma_driver' : None, |
| 'screen_refreshTime' : 0.02, |
| 'i2cPort' : 8, # Replace this with the I2C bus you are connecting to. This is when I plug it into the Digispark on my desktop PC |
| 'i2cAddress' : 0x3c, # Replace this with the device ID of your OLED module as returned by i2cdetect |
| 'mode' : [GFX_MODE_NUMERIC], |
| 'currentModeIdx' : 0, |
| 'currentMode' : GFX_MODE_NUMERIC, |
| 'sensorIds' : ['AFR', 'AMAL', 'BAT', 'CO', 'ECT', 'IAT', 'IGNADV', 'INJDUR', 'MAP', 'RPM', 'TPS'], |
| 'currentSensorIdx' : 0, |
| 'screen_cycleTime' : 5, |
| 'value_refreshTime' : 0.1, |
| 'screen_refreshTime' : 0.05, |
| } |
| </code> |
| |
| That's it. All I2C comms (including the graphics routines used by Luma.oled and in turn by PyCosworth) will work unmodified and you can run your OLED display from your PC: |
| |
| {{:blog:pycosworth:img20210817161146.jpg?400|}} |
===== My Current Setup ===== | ===== My Current Setup ===== |
| |