Lilygo T-Can boards for web UI

Discussion about various user interfaces such as web interface, displays and apps
Post Reply
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Lilygo T-Can boards for web UI

Post by Bigpie »

I'm using a Lilygo T-Can board available from Aliexpress for ~£14 for the can backend web interface. The pin mappings are different and it requires an output setting to enable CAN. Lilygo says max input of 12V but the voltage regulator IC has an absolute max of 18V, it's running fine when my DCDC is active at 14.5V


I'll get round to doing a PR for being able to select the board, but for now the code is here: https://github.com/jamiejones85/esp32-w ... ilygo_tcan

I've implemented a dark mode theme, and also a drive mode page.

Still todo, I want to log all the spot params to the SD card next automatically when driving.

Screenshot 2024-08-04 at 4.14.20 pm.png
Screenshot 2024-08-04 at 4.14.30 pm.png
There's a decent 3D printable case for it here: https://github.com/Xinyuan-LilyGO/T-CAN485/pull/26
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
jrbe
Posts: 439
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 133 times
Been thanked: 122 times

Re: Lilygo T-Can boards for web UI

Post by jrbe »

Bigpie wrote: Sun Aug 04, 2024 3:21 pm
I've implemented a dark mode theme, and also a drive mode page.
That looks great!

One thing to consider for dark mode, blue is the least friendly color for eye strain. It can also mess with circadian rhythm (can mess with your sleep cycle after dusk.)

I know, lots of dark modes use blue as their main color after black / dark. I'm guessing they aren't aware of these 2 things when choosing or using blue.
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

It's fairly easy to change colour scheme so might add some more and a switcher at some point.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
dadiowe
Posts: 166
Joined: Fri Sep 17, 2021 6:11 pm
Has thanked: 53 times
Been thanked: 25 times

Re: Lilygo T-Can boards for web UI

Post by dadiowe »

I am struggling to compile the esp32-web-interface-lilygo_tcan. Arduino IDE detects the board as a lilygo T-display but there is no board listed as the lilygo T-can. I have now got all the needed libraries but I am getting this error,
In file included from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/Sd2Card.h:26,
from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/SdFat.h:29,
from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/SD.h:20,
from C:\Users\Administrator\Desktop\esp32-web-interface-lilygo_tcan\esp32-web-interface\esp32-web-interface.ino:57:
C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/Sd2PinMap.h:527:2: error: #error Architecture or board not supported.
527 | #error Architecture or board not supported.

Any help would be appreciated
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

Are you using Arduino IDE or platform IO?
Are you using the branch on my repo or the Johannes repo?
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
dadiowe
Posts: 166
Joined: Fri Sep 17, 2021 6:11 pm
Has thanked: 53 times
Been thanked: 25 times

Re: Lilygo T-Can boards for web UI

Post by dadiowe »

I am using Arduino IDE 1.8.19. The attached is a picture of the suggested settings for the tcan from lilygo for programming the board also the board I have selected is ESP32 dev Module. The repo is from Jamies github.
When I try to compile i get this output,

In file included from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/Sd2Card.h:26,
from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/SdFat.h:29,
from C:\Users\Administrator\Documents\Arduino\libraries\SD\src/SD.h:20,
from C:\Users\Administrator\Desktop\esp32-web-interface-lilygo_tcan\esp32-web-interface\esp32-web-interface.ino:57:
C:\Users\Administrator\Documents\Arduino\libraries\SD\src/utility/Sd2PinMap.h:527:2: error: #error Architecture or board not supported.
527 | #error Architecture or board not supported.

Thanks for looking at this Bigpie.
Attachments
arduino_setting.png
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

I've attached the compiled binaries, you can use something like https://github.com/doayee/esptool-esp32 ... es/tag/0.1 to flash them.
Attachments
spiffs.bin
(1.44 MiB) Downloaded 75 times
firmware.bin
(899.34 KiB) Downloaded 75 times
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
dadiowe
Posts: 166
Joined: Fri Sep 17, 2021 6:11 pm
Has thanked: 53 times
Been thanked: 25 times

Re: Lilygo T-Can boards for web UI

Post by dadiowe »

Thanks bigpie. BUT, sorry to be a pain i have 3 options boxes, Flash app, flash partition and flash boot loader. I flashed both bins to flash app and had a firmware update page when connecting to the board wifi with 192.168.4.1 but thats all i got . I think I may need to erase and start again but the programme says I must flash all 3 files and I only have to.

As you can guess I am a bit of a numpty in this field
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

firmware.bin goes to app, spiffs to partition, bootloader doesn't need changing. I don't use windows, so not familiar with apps on it.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
dadiowe
Posts: 166
Joined: Fri Sep 17, 2021 6:11 pm
Has thanked: 53 times
Been thanked: 25 times

Re: Lilygo T-Can boards for web UI

Post by dadiowe »

little steps, I tried stm32-vcu.bin in update firmware it says update errorwrong magic byte :?
Attachments
20240909_100719.jpg
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

Screenshot 2024-09-09 at 11.37.42 am.png
so /update is for updating the ESP32, the firmware is the firmware.bin, the FileSystem is the spiffs.bin.
If you're getting can communications, and you want to update the STM32 you need to use the update on the main interface page.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
dadiowe
Posts: 166
Joined: Fri Sep 17, 2021 6:11 pm
Has thanked: 53 times
Been thanked: 25 times

Re: Lilygo T-Can boards for web UI

Post by dadiowe »

Sorry to waste all your time.

Yep, I tried the stm vcu.bin out of desperation. I can now connect to the board again but when I do "file not found" comes up then I get the upload page.

I have managed to get the firmware.bin to upload but the filesystem spiffs.bin gives an Update error "Bad size Given"
evMacGyver
Posts: 153
Joined: Tue Jun 15, 2021 5:44 pm
Location: Finland
Has thanked: 38 times
Been thanked: 7 times

Re: Lilygo T-Can boards for web UI

Post by evMacGyver »

In first place I did try wrong branch, after getting correct one it gives me some errors about setValueSdo() function, commented errror lines to get lilygo-tcan compile somehow.

I have not used esptool.py before to flash whole thing, so I compiled using Arduino 2.3.3 and same board settings as dadiowe above, I also can go to 192.168.4.1/update and try upload filesystem using spiffs.bin complains the same "Bad size given". I can update attached firmware.bin using /update page, but no difference using it.

Tried using upload.sh 192.168.4.1, it does not complain anything but still no pages other than /update and some "buildin" pages like /sdcard/list and /version which do respond.

Trying using browser 192.168.4.1/edit which upload.sh uses, gives FileNotFound output. So something to do with spiffs?

Changed Partition Scheme to "No OTA (2MB APP/2MB SPIFFS)" with no difference. Like "Erase All Flash Before Sketch Upload: Enabled" to erase everything.

Something is wrong but I don't understand what..
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

are you using Windows? I've some fresh boards coming and will do some step by step instructions for boards out of the box. I don't use windows usually but got an old windows laptop that I'll use for it.

The bad size given might be a library version issue https://github.com/espressif/arduino-esp32/issues/6482

These are the exact versions I have

Code: Select all

Dependency Graph
|-- ESP32Time @ 2.0.6
|-- ArduinoJson @ 6.21.5
|-- StreamUtils @ 1.9.0
|-- SPI @ 2.0.0
|-- ArduinoOTA @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- FS @ 2.0.0
|-- HTTPUpdateServer @ 2.0.0
|-- SD @ 2.0.0
|-- Ticker @ 2.0.0
|-- WebServer @ 2.0.0
|-- WiFi @ 2.0.0
|-- SPIFFS @ 2.0.0
|-- EEPROM @ 2.0.0
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
Zieg
Posts: 232
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 106 times
Been thanked: 94 times

Re: Lilygo T-Can boards for web UI

Post by Zieg »

This is really cool! The second screenshot with the battery info, how is it getting that to the web interface?
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

It's getting the values from zombie. So depends on components used, but BMS/Shunt integration populates the spot values and the UI grabs them for display
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
evMacGyver
Posts: 153
Joined: Tue Jun 15, 2021 5:44 pm
Location: Finland
Has thanked: 38 times
Been thanked: 7 times

Re: Lilygo T-Can boards for web UI

Post by evMacGyver »

Bigpie wrote: Wed Oct 16, 2024 6:53 pm are you using Windows? I've some fresh boards coming and will do some step by step instructions for boards out of the box.

The bad size given might be a library version issue https://github.com/espressif/arduino-esp32/issues/6482
I only use Linux, esptool would be nice but I did not get it to work yet, even Arduino uses it for uploading.
esptool.py -p /dev/ttyACM0 write_flash 0x10000 firmware.bin -e
After this wifi never comes available.
Edit: after one arduino flash I could flash firmware with esptool without flash erase; it was missing bootloader I believe. Still don't know what address spiffs should be written.

Upgraded Arduino ESP32 libraries from 3.0.0 to 3.0.5 with no change.

Because I did not get esptool flash with correct firmware.bin to boot, my plan was to compile and use /update to update firmware.bin. This succeeded, but was not happy if I uploaded Filesystem spiffs.bin, same error. Maybe web firmware update did not succeeded after all, not sure.
User avatar
Bigpie
Posts: 1709
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 370 times

Re: Lilygo T-Can boards for web UI

Post by Bigpie »

So, just had a couple of box fresh Lilygos delivered to do this.

Here's the esptool command, all binaries in the attached zip.

Code: Select all

esptool.py --chip esp32 --port "/dev/cu.wchusbserial58CE0145831" --baud 460800 --before default_reset --after hard_reset write_flash -z  --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 bootloader_qout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin 0x00290000 spiffs.bin
I'll next switch to windows and find a GUI tool for the other.
Attachments
lilygo-ui.zip
(867.86 KiB) Downloaded 36 times
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
zl3ag
Posts: 27
Joined: Tue Oct 24, 2023 8:54 am
Location: CHCH New Zealand
Has thanked: 5 times
Been thanked: 3 times
Contact:

Re: Lilygo T-Can boards for web UI

Post by zl3ag »

On a slight tangent, you can do firmware downloads via USB using Chromium/Chrome/Edge browser.

An example is the firmware for Meshtastic LoRa networks...

https://flasher.meshtastic.org/
evMacGyver
Posts: 153
Joined: Tue Jun 15, 2021 5:44 pm
Location: Finland
Has thanked: 38 times
Been thanked: 7 times

Re: Lilygo T-Can boards for web UI

Post by evMacGyver »

Many thanks, this has been great solution to add wifi range! Will try with external antenna some day to get even better.

When using mostly with zombie I can't see all spot values, just for example I12 and current time values. What makes values to be shown?

Also I think I saw current CAN mappings in the beginning but now shows nothing. Tried to add one mapping which did not show up in UI, so I verified with OIC tool and all mappings including new one was there. ESP32 reset or power cycle not bringing CAN mappings to UI. Any ideas?
Post Reply