DAVEga: Battery monitor, odometer, speedometer

I did use double sided tape so the screen doesn’t flop around. It was place under the screen opposite to where screen port is. The screen connector prongs were cut a little to get it to work w that enclosure. Otherwise, I can’t screw the lid.

Hope this helps

This is correct, buttons don’t work until connected to vesc

2 Likes

It’s not for any particular truck, so long as your using the old school bolt pattern. The longer of the two patterns. Then the bolt heads can be accessed through the print, but they are not holding it down.

The case is just meant to be stuck down with high quality double tape.

1 Like

@pookybear err the davga logo is meant to be on the right side, its not meant to fit like that. It will fit together much better if you turn the top half 180 deg. There is a locating feature that is meant to make the orientation more obvious, I guess it’s not that effective.

1 Like

15583225155911025321577

You mean this notch?

1 Like

Crap. I see it now

Yes, lol. Surprising you got shut.

Gorilla grip brah. LOL

@lrdesigns

1558324234918467087694

3 Likes

So I was looking into info about the ili9225 display driver chips that the 2 inch screens it uses, and it seems like the max resolution they support is only 176x220. I’m itching to try and make a DAVEga using a 2.8", 320x240 resolution screen and an arduino nano (the extra display size is definitely worth it). I just ordered the parts and I’ll reply to this once it all comes in and I make progress porting over the display code to work with ili9341 display drivers. Will be a couple weeks till all parts arrive :slight_smile:

Sounds good. You may want to check this for an example of enabling a screen with a different driver: https://github.com/janpom/davega/commit/5bf124cdb6d8572699983b6b5258442c78a6f7c2

Note that the new DAVEga that we’re currently working on together with @lrdesigns will use exactly the display that you mention. Plus, it will come in a nice aluminum case and with a lot of new features. You may just as well want to wait for that one. It should be available around August.

1 Like

Good to hear! By chance, have you taken a look at this optimized version of the ili9341?

I used it in a previous project involving some custom animations and it was a godsend for my performance.

3 Likes

Hey guys, noob question, Is there like a parts list or something and where can I get the PCB from?

All info needed is on the github

1 Like

Thank you :grinning:

@janpom or anyone, im an old guy trying really hard here to get my dga going, ive followed the instructions but i get this and my dga has a white screen :frowning:

Any help much appreciated

20190605_214624

Looks like the compiler is having hard time compiling your code. This may be a bug in the compiler. It’s not unheard of. You could try a different version of Arduino IDE and see if that helps.

Have you done any changes to the code (including the config) before trying to compile? If you did, please try to compile the vanilla code first. If that works, please provide the code changes you have made. I suppose you have only touched the davega_config.h so ideally send that file.

1 Like

Thanks @janpom, i trued a different ide and its working great :slight_smile: Your opening message had me slightly worried for a second :smile:

20190605_231044

1 Like

I finally soldered the switches up and connected it to the unity, set the baud rate in the app and applied it and while the screen lights up correctly the buttons appear to do nothing and the screen does not show any live data, what have I missed please?

here is my config file, sorry I do not know how to show it any other way…

/*
    Copyright 2018 Jan Pomikalek <[email protected] This file is part of the DAVEga firmware.

    DAVEga firmware is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    DAVEga firmware is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DAVEga firmware.  If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef DAVEGA_CONFIG_H
#define DAVEGA_CONFIG_H
#define NOEASTER
// To compile for FOCBOX Unity, uncomment the following line.
#define FOCBOX_UNITY 1

#define VESC_COUNT 1  // number of controllers: 1 = single, 2 = dual (set to 1 for FOCBOX Unity unless you have more than 1)
#define MOTOR_POLE_PAIRS 7
#define WHEEL_DIAMETER_MM 110
#define MOTOR_PULLEY_TEETH 15
#define WHEEL_PULLEY_TEETH 39

// Affects the speed indicator. If MAX_SPEED_KPH is exceeded, no major disaster will happen.
// The speed indicator will merely indicate the current speed as the max speed (all blue rectangles
// filled). It will still show the correct number though.
#define MAX_SPEED_KPH 50

// Set to true to display the distance in miles and the speed in mph.
#define IMPERIAL_UNITS true

// Set to true to display the temperature in Fahrenheit instead of Celsius.
#define USE_FAHRENHEIT false

#define BATTERY_S 12  // number of battery cells
#define BATTERY_MAX_MAH 8000  // battery capacity in mAh
#define BATTERY_USABLE_CAPACITY 0.8  // [0.0, 1.0]

// If SHOW_AVG_CELL_VOLTAGE is true, average cell voltage is displayed instead of the total battery
// pack voltage (total voltage is divided by the number of cells).
#define SHOW_AVG_CELL_VOLTAGE true

// The two options below are for detecting that battery has been fully charged (in which case
// we reset the available mAh to the max value). We think that the battery has been fully charged
// if the voltage has increased at least a little bit since the last remembered state AND the
// battery voltage is close to the max value (which is the last value in DISCHARGE_TICKS, see below).

// How much the battery voltage must increase since the last remembered state so that
// so that we think the battery has been charged.
#define FULL_CHARGE_MIN_INCREASE 0.01  // [0.0, 1.0]

// Minimal percentage of the max battery voltage to consider the battery fully charged.
// Example: With 0.97, if the max voltage is 50.4 V, then 48.888 V or more is considered fully charged.
#define FULL_CHARGE_THRESHOLD 0.97  // [0.0, 1.0]

// The DISCHARGE_TICKS can be used for configuring the battery discharge profile. The first value in the
// array is the voltage for fully discharged and the last value is the voltage for fully charged. The
// array may contain any number of values representing equidistant points of the discharge curve. For
// example, with 5 values, the voltages will be interpreted as 0%, 25%, 50%, 75%, and 100% of the battery
// capacity respectively.
#define DISCHARGE_TICKS { \
    3.5 * BATTERY_S, \
    3.67 * BATTERY_S, \
    3.73 * BATTERY_S, \
    3.76 * BATTERY_S, \
    3.80 * BATTERY_S, \
    3.83 * BATTERY_S, \
    3.86 * BATTERY_S, \
    3.90 * BATTERY_S, \
    4.0 * BATTERY_S, \
    4.2 * BATTERY_S, \
}

// Remaining battery capacity can be estimated from the battery voltage
// and from the VESC coulomb counter (number of mAh spent). The VOLTAGE_WEIGHT is
// the weight of the battery voltage in the calculation. (1.0 - VOLTAGE_WEIGHT) is
// then the weight of the coulomb counter.
//
// In particular,
// 1.0 = only use battery voltage for estimating remaining capacity.
// 0.0 = only use coulomb counter for estimating remaining capacity.
#define VOLTAGE_WEIGHT 0.4

// Changing the EEPROM_MAGIC_VALUE (to any value different from the current, e.g. 42 -> 43) will reset
// the EEPROM to the values defined below. This is especially handy for pre-setting the total distance
// traveled (EEPROM_INIT_VALUE_TOTAL_DISTANCE).
#define EEPROM_MAGIC_VALUE 43  // [1, 255]

#define EEPROM_INIT_VALUE_VOLTS 0
#define EEPROM_INIT_VALUE_MAH_SPENT 0
#define EEPROM_INIT_VALUE_MAX_SPEED 0
#define EEPROM_INIT_VALUE_MILLIS_ELAPSED 0
#define EEPROM_INIT_VALUE_MILLIS_RIDING 0
#define EEPROM_INIT_VALUE_MIN_VOLTAGE 60
#define EEPROM_INIT_VALUE_TRIP_DISTANCE 0  // meters
#define EEPROM_INIT_VALUE_TOTAL_DISTANCE 0  // meters

// After how many meters traveled should the distance (and other values) be stored to EEPROM.
// The EEPROM lasts for 100,000 write cycles. With EEPROM_UPDATE_EACH_METERS=100, the EEPROM
// should last for 10,000 km. If the value is set lower, the EEPROM will die earlier.
// Note that EEPROM is also updated whenever the board comes to a stop (see below), so regardless
// of how EEPROM_UPDATE_EACH_METERS is set, there won't be missed meters unless DAVEga is accidentally
// reset before saving to EEPROM (which shouldn't happen under normal circumstances).
#define EEPROM_UPDATE_EACH_METERS 100

// If the board comes to stop, update EEPROM, unless it was already updated in less than
// EEPROM_UPDATE_MIN_DELAY_ON_STOP millis when the board stopped. This shouldn't happen
// under normal circumstance and is mainly a safeguard against destroying EEPROM in case
// unexpected oscillating speed readings are retrieved from the VESC.
//
// The EEPROM will still be updated if it was previously updated in less than
// EEPROM_UPDATE_MIN_DELAY_ON_STOP due to EEPROM_UPDATE_EACH_METERS. (Otherwise, meters would be missed.)
#define EEPROM_UPDATE_MIN_DELAY_ON_STOP 10000

// Hold button 1 for this time to reset session data.
// Hold button 2 for this time to reset the Coulomb counter.
#define COUNTER_RESET_TIME 3000  // ms

// This corresponds (more or less) to how often data is read from VESC.
#define UPDATE_DELAY 50  // ms

// 0=portrait, 1=right rotated landscape, 2=reverse portrait, 3=left rotated landscape
#define SCREEN_ORIENTATION 3

// Screens. Uncomment the ones you want enabled.
//#define DEFAULT_SCREEN_ENABLED 1
#define SIMPLE_HORIZONTAL_SCREEN_ENABLED 1
//#define SIMPLE_HORIZONTAL_SCREEN_WITH_BATTERY_CURRENT_ENABLED 1
//#define SIMPLE_HORIZONTAL_SCREEN_WITH_MOTOR_CURRENT_ENABLED 1
//#define SIMPLE_VERTICAL_SCREEN_ENABLED 1
//#define SIMPLE_VERTICAL_SCREEN_WITH_BATTERY_CURRENT_ENABLED 1
//#define SIMPLE_VERTICAL_SCREEN_WITH_MOTOR_CURRENT_ENABLED 1
#define TEXT_SCREEN_ENABLED 1

// Information to be displayed on the text screen. Only relevant if TEXT_SCREEN_ENABLED is set.
// Available options:
//    SCR_FW_VERSION
//    SCR_FAULT_CODE
//    SCR_MOSFET_TEMPERATURE
//    SCR_MOTOR_TEMPERATURE
//    SCR_MOTOR_CURRENT
//    SCR_BATTERY_CURRENT
//    SCR_DUTY_CYCLE
//    SCR_TOTAL_VOLTAGE
//    SCR_MIN_TOTAL_VOLTAGE
//    SCR_AVG_CELL_VOLTAGE
//    SCR_BATTERY_CAPACITY_MAH
//    SCR_BATTERY_CAPACITY_PERCENT
//    SCR_TRIP_DISTANCE
//    SCR_TOTAL_DISTANCE
//    SCR_SPEED
//    SCR_MAX_SPEED
//    SCR_AVG_SPEED
//    SCR_TIME_ELAPSED
//    SCR_TIME_RIDING
#define TEXT_SCREEN_ITEMS { \
    SCR_FAULT_CODE, \
    SCR_MOSFET_TEMPERATURE, \
    SCR_MOTOR_TEMPERATURE, \
    SCR_MOTOR_CURRENT, \
    SCR_BATTERY_CURRENT, \
    SCR_DUTY_CYCLE, \
    SCR_TOTAL_VOLTAGE, \
    SCR_MIN_TOTAL_VOLTAGE, \
    SCR_AVG_CELL_VOLTAGE, \
    SCR_BATTERY_CAPACITY_MAH, \
    SCR_BATTERY_CAPACITY_PERCENT, \
    SCR_TRIP_DISTANCE, \
    SCR_TOTAL_DISTANCE, \
    SCR_SPEED, \
    SCR_MAX_SPEED, \
    SCR_AVG_SPEED, \
    SCR_TIME_ELAPSED, \
    SCR_TIME_RIDING, \
}

// Big font is only recommended for landscape orientation. 9 lines fit on the screen then.
// Some items overflow the right order. You may want to adjust the labels in davega_text_screen.cpp.
#define TEXT_SCREEN_BIG_FONT false



#endif //DAVEGA_DAVEGA_CONFIG_H

Do you have PPM and UART enabled? Check your tx and RX pins.