Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,10 @@ For free dashboard downloads go to https://tunerstudiodashboards.com/ (you will
<br>
<br>
## **Arduino Setup**
After the dashboard is setup how you like, the fun starts. I utilized a arduino to communicate with the Pi and TS Dash to pass sensor data. The ```.ino``` file in this repo contains all the code to add the Arduino Mega. I will try to keep this file updated with suggestions from users or with additions I find useful
After the dashboard is setup how you like, the fun starts. I utilized a arduino to communicate with the Pi and TS Dash to pass sensor data. The ```digital-dash-arduino``` platformio project in this repo contains all the code to add the Arduino Mega. I will try to keep this file updated with suggestions from users or with additions I find useful
<br>
<br>
To upload the ```.ino``` to the arduino you will need the ArduinoIDE(https://www.arduino.cc/en/software/) and to download it to a separate machine(not needed on the Pi)
<br>
<br>
Once you have the arduinoIDE installed and open on your machine, open the ```.ino``` in the IDE.
<br>
<br>
Connect your Arduino Mega via usb and select the proper USB/location of the Arduino at the top right of the IDE.
<br>
<br>
Press the right arrow button in the upper right(upload) to transfer the ```.ino``` to the arduino.
<br>
<br>
Wait for it to say "Done uploading" at the bottom and then you can unplug the arduino.
Please follow the instrustions in the [README.md file in digital-dash-arduino](digital-dash-arduino/README.md)
<br>
<br>
After that you just need to wire the sensors to the arduino. My youtube video goes over that in depth, but basically you need to utilize sensors that already exist on your vehicle or purchase new ones solely for this purpose.
Expand Down
3 changes: 0 additions & 3 deletions Raspberry Pi IMGs/pi5-travis.cea-digital-dash.img.xz

This file was deleted.

5 changes: 5 additions & 0 deletions digital-dash-arduino/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
8 changes: 8 additions & 0 deletions digital-dash-arduino/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"pioarduino.pioarduino-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ It will be up to you to determine, based off TimeStamps, IDs, and Data, what eac
## Adding MCP2515 to Arduino to access CANBUS ##
This effectively makes the Arduino a CANBUS node

The specific INO file for HALTECHs or other standalones which is in the project will need to be uploaded to the Arduino via Arduino IDE

In the IDE, the appropriate library needs to be installed so that the ino file(referenced above) has access to it.
Do this by:
- Going to the top and clikcing: ```Sketch → Include Library → Manage Libraries```
- Search for ```MCP_CAN```
- This the libary the CANBUS ino's use ```#include <mcp_can.h>```
The build flag 'CAN_ENABLED' in platformio.ini for HALTECHs or other standalones which is in the project will need to be uploaded to the Arduino via platformio in vscode


## Part needed: ##
Expand Down
15 changes: 15 additions & 0 deletions digital-dash-arduino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Arduino MEGA 2560 project setup #

1. Install [visual studio code](https://code.visualstudio.com/Download)
2. Install the platformio extension
* Open VSCode Package Manager
* Search for the official platformio ide extension
* Install PlatformIO IDE. <br><img width="356" height="245" alt="image" src="https://github.com/user-attachments/assets/87de76bd-3424-4039-af0c-b0152788d397" />

3. Double click `digital-dash-arduino.code-workspace` to open the project
* platformio will automatically download and install the dependencies required for the project <br> <img width="662" height="351" alt="image" src="https://github.com/user-attachments/assets/fb826438-3ba0-4a74-9cd5-d65f1392a2cb" />

4. Open the file `platformio.ini` and configure the project
* If you need CAN enabled, uncomment the line for CAN <br> <img width="513" height="42" alt="image" src="https://github.com/user-attachments/assets/913ea828-0b08-4fa5-a469-1266dc95f5e9" />

5. Plug in your mega 2560 and click the button in the right to upload the code <br><img width="259" height="167" alt="image" src="https://github.com/user-attachments/assets/8adfb0e3-8582-4537-9db0-8286d385837c" />
8 changes: 8 additions & 0 deletions digital-dash-arduino/digital-dash-arduino.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
37 changes: 37 additions & 0 deletions digital-dash-arduino/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the convention is to give header files names that end with `.h'.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
46 changes: 46 additions & 0 deletions digital-dash-arduino/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into the executable file.

The source code of each library should be placed in a separate directory
("lib/your_library_name/[Code]").

For example, see the structure of the following example libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

Example contents of `src/main.c` using Foo and Bar:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

The PlatformIO Library Dependency Finder will find automatically dependent
libraries by scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
21 changes: 21 additions & 0 deletions digital-dash-arduino/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
; upload_speed = 115200

build_flags =
; Note: Uncomment the following line to enable CAN bus support
; -D CAN_ENABLED
lib_deps =
coryjfowler/mcp_can@^1.5.1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef CAN_ENABLED
// =======================================================
// Travis Digital Dash – Haltech CAN → TS Dash Serial Bridge
// Arduino Mega 2560 + MCP2515 (16MHz) @ 500kbps
Expand Down Expand Up @@ -302,3 +303,4 @@ void loop() {
handleSerialByte((uint8_t)Serial.read());
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef CAN_ENABLED
// =======================================================
// Travis Digital Dash – TunerStudio Interface
// FINAL PRODUCTION BUILD + BATT VOLTAGE
Expand Down Expand Up @@ -248,6 +249,7 @@ static inline uint8_t clampU8(int v){
return v;
}

float readAdcFiltered(int pin, float &ema, uint8_t samples, uint8_t trim, float alpha);
uint16_t readBatteryVoltage_x10(float &ema) {
float adc = readAdcFiltered(BATT_VOLTAGE_PIN, ema, 8, 1, EMA_ALPHA_SLOW);
float vAdc = adc * (VREF / ADC_MAX);
Expand Down Expand Up @@ -895,3 +897,4 @@ void loop(){
else if (c == 'd') { readU16LE(); uint32_t crc=0; Serial.write((uint8_t*)&crc,4); }
}
}
#endif
11 changes: 11 additions & 0 deletions digital-dash-arduino/test/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

This directory is intended for PlatformIO Test Runner and project tests.

Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.

More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html