# CANserver Development



## JWardell

I made the CANserver to connect to the Model 3/Y CAN bus and broadcast data to microDisplays with a Wifi network, but they have unlimited possibilities if many folks work together to improve the software.

While the product is not quite ready for public consumption, we already have a need for the handful of people working on software to collaborate, so that's the intention of this thread. A separate thread will be made for public discussion and questions of the products when they are ready.

Arduino software and all technical documentation can be found here on GitHub. Please familiarize yourself with documentation fully before asking questions here.


----------



## iChris93

Thanks for getting this project started, @JWardell.

While I do not have any hardware yet, I have started to work on a project to take the information from @JWardell's DBC file and put it into an XLSX format. The goal of the project is to end up with a data set of message and signal information that can be used by the Arduino code to decode signals.

The project information can be found here and an example output from @JWardell's latest DBC file is here.

My questions now: Is the output file a useful format? What changes can I make to make it more useful?

Hopefully when I get the hardware, I will have time to start answering these questions myself too.


----------



## TrevP

Awesome, can’t wait to see what people do with this!


----------



## All About Jake

For users of the tesLAX CANBus Explorer app for iOS my hope is to add support for the CANServer over WiFi as a data source in addition to the OBDLink MX+ bluetooth dongle!


----------



## oshw

If you need any hardware help (physical hardware, EE design / PCBs, questions, etc) let me know.
(Edit: looks like you're doing fine on your own though)


----------



## pyjamasam

I'm interested in helping with the software side. More than happy to start implementing parsing for various messages. Also happy to help with the integration to tesLAX (I have both Objective-C and Swift experience as well as C/C++).

Let me know how I can help.

chris.


----------



## JWardell

Huge thanks to @All About Jake who has now added over-the-air programming with PlatformIO support!
While you can still use Arduino with a USB connection, you can alternately install and use platfomio to build on the command line and reflash your new code over wifi.

In other words no need to drag the laptop to the car or uninstall things, no need for pressing buttons... from the comfort of your couch you can connect to the CANserver wifi and upload new code.
Awesome!


----------



## iChris93

iChris93 said:


> Thanks for getting this project started, @JWardell.
> 
> While I do not have any hardware yet, I have started to work on a project to take the information from @JWardell's DBC file and put it into an XLSX format. The goal of the project is to end up with a data set of message and signal information that can be used by the Arduino code to decode signals.
> 
> The project information can be found here and an example output from @JWardell's latest DBC file is here.
> 
> My questions now: Is the output file a useful format? What changes can I make to make it more useful?
> 
> Hopefully when I get the hardware, I will have time to start answering these questions myself too.


I've saved the resulting XLSX file as a CSV file on an SD card and created an Arduino sketch that looks up message ID, signal start bit, signal length, signal factor, signal offset, and signal unit from the CSV file on the SD card based off of an inputed signal name. Is this how I should be looking for signal information, based off of a signal name? It seems like it might not be the best choice because you have to know the exact signal name of the signal you're looking for but I am not sure how else you would do it.


----------



## JWardell

iChris93 said:


> I've saved the resulting XLSX file as a CSV file on an SD card and created an Arduino sketch that looks up message ID, signal start bit, signal length, signal factor, signal offset, and signal unit from the CSV file on the SD card based off of an inputed signal name. Is this how I should be looking for signal information, based off of a signal name? It seems like it might not be the best choice because you have to know the exact signal name of the signal you're looking for but I am not sure how else you would do it.


I'm just imagining a more simple way of having ~10 signals set to monitor, configured with a served web page or phone app, not really having the DBC on the server. I want it to be able to function without an SD card. Then you basically assign each display the signal you want to view from that set. All saved hopefully in eeprom. Hoping to explore ESP32 eeprom libraries this week.

But as a bonus, it certainly WOULD be nice to have a button on that same setting page to load a DBC off an SDcard (or point to web address? Or github?) and select a signal. But I imagine that could eat up a lot of code or RAM.


----------



## JWardell

Code updated tonight to turn the displays "off" (they display black) whenever the car's center screen turns off. I grab the UI_displayOn signal.
It's a nice signal to watch to deactivate any other electronics that you wish powered off when you leave the car.


----------



## iChris93

As I only have one uDisplay, but two CANservers, I've been trying to find a way to get the two servers to communicate with each other so they can share a display. I finally had a breakthrough tonight using websockets. Now, one display can display information from the powertrain bus normally and then show arrows for blind spots from the chassis bus when there is blind spot warning, and then back to the powertrain bus.


----------



## All About Jake

I've had websockets in the back of my mind for a while. The asynchttpserver that @JWardell is already using has websocket support.

I've also considered UDP multicast as an option. I like this because can servers can send UDP packets to all clients on the network and a display could choose to use or ignore a packet depending on what it is configured to show.

Also, the 1.2 beta of tesLAX has support for the Panda OBD-2 interface, and I've sent a pull request that allows CANServer to emulate the Panda... so you can now stream data from CANserver to tesLAX.

Also, I want to look into WIFI_MODE_APSTA, which would allow the ESP32 to be both a WiFi station to serve the displays, as well as a client to the user's home network. My goal would be able to access the CANServer over my home wifi network for OTA and development while not touching the station mode that is used by the displays.


----------



## iChris93

All About Jake said:


> I like this because can servers can send UDP packets to all clients on the network


I believe the TCP the websockets are using can broadcast packets to all clients or send to a specific client.


----------



## iChris93

All About Jake said:


> I like this because can servers can send UDP packets to all clients on the network and a display could choose to use or ignore a packet depending on what it is configured to show.





iChris93 said:


> I believe the TCP the websockets are using can broadcast packets to all clients or send to a specific client.


They implement broadcasting to all clients in this Library file. Check it out on line 222


> broadcastTXT(uint8_t * payload, size_t length, bool headerToPayload)





All About Jake said:


> Also, the 1.2 beta of tesLAX has support for the Panda OBD-2 interface, and I've sent a pull request that allows CANServer to emulate the Panda... so you can now stream data from CANserver to tesLAX.


This is great! Do you have to get the beta from TestFlight?


----------



## JWardell

This is exciting. I’ve been too busy this week to even test all the great pull requests you guys made. And I think we will have a few more people helping soon.


----------



## iChris93

I have basic data logging working with an SD card and two different log files: One for driving, one for charging.

Here are some Excel plot examples with data taken every 5 seconds. 
Charging this evening from 48% to 55% with charging scheduled for 7pm. 








And then from a trip to pick-up dinner. 









Hardware revision suggestion for @JWardell: having a µSD card that can be inserted and ejected without removing the case and ESP32 board would make things easier.


----------



## JWardell

iChris93 said:


> I have basic data logging working with an SD card and two different log files: One for driving, one for charging.
> 
> Here are some Excel plot examples with data taken every 5 seconds.
> Charging this evening from 48% to 55% with charging scheduled for 7pm.
> View attachment 34479
> 
> And then from a trip to pick-up dinner.
> View attachment 34481
> 
> 
> Hardware revision suggestion for @JWardell: having a µSD card that can be inserted and ejected without removing the case and ESP32 board would make things easier.


So it's actually working? Wasn't sure I tracked everything right 

I picked the open-ended case specifically so you could access the sd card and USB port from the side.
Unfortunately I didn't realize when picking a PCB part that I had a flip-up sd card socket. You SHOULD still be able to flip it up a little and remove the card without opening the whole case. I definitely plan to replace it with a push-in socket on the next board rev

I will have to try your pull request asap (along with the others I've been too busy to test)


----------



## iChris93

JWardell said:


> So it's actually working? Wasn't sure I tracked everything right
> 
> I picked the open-ended case specifically so you could access the sd card and USB port from the side.
> Unfortunately I didn't realize when picking a PCB part that I had a flip-up sd card socket. You SHOULD still be able to flip it up a little and remove the card without opening the whole case. I definitely plan to replace it with a push-in socket on the next board rev
> 
> I will have to try your pull request asap (along with the others I've been too busy to test)


Yeah, it worked no problem and with the libraries that are pre-loaded for the ESP32.

I've been able to remove it as you suggest, but trying to close it pops the cover off. I wonder if there is a push-in socket with the same footprint?

With the chassis and powertrain servers communicating, I can log the GPS coordinates with the other data. Might be useful for finding a cool way to plot the data.


----------



## JWardell

Not that I can find, I regretted not buying the part before laying out, now I've bought 6 more psuh sd card sockets and none have the footprint of that one. It's triple the price of the others too. 

Yes, you can imagine it would be spectacular to map data around a racetrack etc. So many great possibilities to continuous data logging.


----------



## iChris93

JWardell said:


> Yes, you can imagine it would be spectacular to map data around a racetrack etc. So many great possibilities to continuous data logging.


Here is an example from a short trip yesterday. Using GPSVisualizer.com, I could upload a .csv file to plot data using open street maps. The csv file needs a header row of at least latitude and longitude. You can then customize the coloring of the track based off of other columns in the csv file. For this example, I plotted battery power [kW]. The GPS data and battery power were saved in the same log every 5 seconds, as the chassis CANserver was sending the GPS data to the powertrain CANserver for it to log all the data.


----------



## xilex

iChris93 said:


> I have basic data logging working with an SD card and two different log files: One for driving, one for charging.


I think it'd be cool to have it start logging in detail once the brake pedal is depressed while in Park (because that's usually before I change the gear), then stop once Park gear is selected again. That would be a perfect automated trip logger. Nevermind, saw you monitored for D/R shift state, even better!



iChris93 said:


> With the chassis and powertrain servers communicating, I can log the GPS coordinates with the other data. Might be useful for finding a cool way to plot the data.


Is the chassis vs powertrain server referring to chassis port vs OBD port? I saw there were two options to plug in but wasn't clear what differences you get from each one.


----------



## iChris93

xilex said:


> I think it'd be cool to have it start logging in detail once the brake pedal is depressed while in Park (because that's usually before I change the gear), then stop once Park gear is selected again. That would be a perfect automated trip logger. Nevermind, saw you monitored for D/R shift state, even better!


Aw, sorry! I don't think I mentioned that here, but that is how I have it setup as you found. 


xilex said:


> Is the chassis vs powertrain server referring to chassis port vs OBD port? I saw there were two options to plug in but wasn't clear what differences you get from each one.


Yes, exactly! Not all signals are on both busses. For example, the GPS information is only on the chassis bus and most of the battery and drive train information is only on the OBD port (powertrain bus).


----------



## xilex

iChris93 said:


> Yes, exactly! Not all signals are on both busses. For example, the GPS information is only on the chassis bus and most of the battery and drive train information is only on the OBD port (powertrain bus).


I see, so you are running two of the CANserver blocks to do that, right? Do we have a document describing the differences? I vaguely recall someone possibly working on it, maybe JWardell in one of his videos. I'm currently doing the API scraping thing, but it is nicer to have this data collection automated with the CANserver device. For GPS, maybe you can toss in a GPS module inside. I'm considering getting a CANserver with a microDisplay to play around with. I have the OBDLink module, but I guess it is limited in terms of automatically logging data to an app as far as I know.


----------



## iChris93

xilex said:


> I see, so you are running two of the CANserver blocks to do that, right?


Yes, exactly. 


xilex said:


> Do we have a document describing the differences? I vaguely recall someone possibly working on it, maybe JWardell in one of his videos.


Here is an out of date document with different tabs for the different busses. 
I was working on an automated decoder, but did not add a column showing which bus the message is from. I may add that later.


----------



## JWardell

I finally merged in @iChris93 CAN message decoding libraries last night. Need to do a few small modifications for a customer to bring back blind spot detection in the next day or two.



xilex said:


> I see, so you are running two of the CANserver blocks to do that, right? Do we have a document describing the differences? I vaguely recall someone possibly working on it, maybe JWardell in one of his videos. I'm currently doing the API scraping thing, but it is nicer to have this data collection automated with the CANserver device. For GPS, maybe you can toss in a GPS module inside. I'm considering getting a CANserver with a microDisplay to play around with. I have the OBDLink module, but I guess it is limited in terms of automatically logging data to an app as far as I know.


I've been promising to document signals of interest on each bus, so folks can decide which to purchase. Also weeks behind on updating the DBC. It's on the list, I swear!

Also canserver install video, new PCB revs, cases, and most importantly easy configuration from a web browser. 
I need to take a space X rocket to a planet with more than 24 hours.


----------



## xilex

JWardell said:


> Also canserver install video, new PCB revs, cases, and most importantly easy configuration from a web browser.


Cool! Should I/we wait to order? I does say pre-order on your webpage.


----------



## JWardell

xilex said:


> Cool! Should I/we wait to order? I does say pre-order on your webpage.


Preorder is so I'm not expected to ship immediately, as I solder many items to order and sometimes wait for parts.
As for new stuff, I haven't started on that so it's at least a month or two away, but I want people to make the right decision, especially considering at the moment customization requires Arduino programming capability. 
At some point in the future hopefully there will be nice professionally manufactured devices with custom enclosures and slick software, but like FSD that will take a while (and the prices will go climb)
But no sense making the DIY folks wait especially for something they can help make better.


----------



## iChris93

JWardell said:


> Need to do a few small modifications for a customer to bring back blind spot detection in the next day or two.


This is broken? As far as I knew it is still working but that same message ID is now on the Powertrain Bus.


----------



## iChris93

xilex said:


> Do we have a document describing the differences?





iChris93 said:


> I was working on an automated decoder, but did not add a column showing which bus the message is from. I may add that later.


Well, later is now and I have updated the decoder. The new output can be found here with both a Vehicle and Chassis Bus sheet for the signals based off of the latest DBC from @JWardell.


----------



## JWardell

iChris93 said:


> Well, later is now and I have updated the decoder. The new output can be found here with both a Vehicle and Chassis Bus sheet for the signals based off of the latest DBC from @JWardell.


The DBC labels everthing as vehicle unless it only appears on chassis [on the day I add the signal]. 
What I really need to do (and why I've put it off so long) is take a real dual-bus log, split them, then analyze message IDs in each, then cross reference to the DBC.

In general, of course, the battery and motors are on vehicle not chassis, so performance signals will want an OBD server, while autopilot and driver assistance signals are only on chassis.


----------



## Mr.K

Any chance for support of the i2c lcd backpack?
https://learn.adafruit.com/i2c-spi-lcd-backpack


----------



## JWardell

Mr.K said:


> Any chance for support of the i2c lcd backpack?
> https://learn.adafruit.com/i2c-spi-lcd-backpack


Well the display is already a display 
The server does have I2C lines available on the PCB if you wanted to do your own thing


----------



## Mr.K

So, i started playing with the new toys. And some questions/comments came up.
I have the e-mobility obd cable that work with the OBD reader and i suppose that it also should power the CANserver? Mine doesn't, i need to have the usb plugged in to power it.

How do you send a triple digit negative value to the display? Negative removes first digit, positive removes the decimal. -1010 comes out as -01.0, 1010 comes out as 101.

"BattAmps" value flips the sign at 819 A, which is less than what the car draws at full throttle. But i see that the code is changed in the latest version, will try that tomorrow.

BattAmps(a):62 BattVolts(b):389 BattPower(c):241 RearTorque(d):492 MinBattTemp(e):32 MaxRegen(f):78 MaxDisChg(g):431 VehSpeed(h):552 BSR(i):0 BSL(j):011
BattAmps(a):234 BattVolts(b):381 BattPower(c):891 RearTorque(d):1525 MinBattTemp(e):32 MaxRegen(f):78 MaxDisChg(g):431 VehSpeed(h):571 BSR(i):0 BSL(j):011
BattAmps(a):604 BattVolts(b):363 BattPower(c):2192 RearTorque(d):2950 MinBattTemp(e):32 MaxRegen(f):79 MaxDisChg(g):431 VehSpeed(h):631 BSR(i):0 BSL(j):011
BattAmps(a):760 BattVolts(b):354 BattPower(c):2690 RearTorque(d):3172 MinBattTemp(e):32 MaxRegen(f):80 MaxDisChg(g):430 VehSpeed(h):728 BSR(i):0 BSL(j):011
BattAmps(a):-723 BattVolts(b):346 BattPower(c):-2501 RearTorque(d):3130 MinBattTemp(e):32 MaxRegen(f):82 MaxDisChg(g):430 VehSpeed(h):824 BSR(i):0 BSL(j):011
BattAmps(a):-673 BattVolts(b):343 BattPower(c):-2308 RearTorque(d):2827 MinBattTemp(e):32 MaxRegen(f):84 MaxDisChg(g):430 VehSpeed(h):923 BSR(i):0 BSL(j):011
BattAmps(a):-673 BattVolts(b):342 BattPower(c):-2301 RearTorque(d):2570 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1010 BSR(i):0 BSL(j):011
BattAmps(a):-667 BattVolts(b):341 BattPower(c):-2274 RearTorque(d):2332 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1087 BSR(i):0 BSL(j):011
BattAmps(a):124 BattVolts(b):381 BattPower(c):472 RearTorque(d):547 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1136 BSR(i):0 BSL(j):011
BattAmps(a):-118 BattVolts(b):395 BattPower(c):-466 RearTorque(d):-532 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1128 BSR(i):0 BSL(j):011
BattAmps(a):-120 BattVolts(b):396 BattPower(c):-475 RearTorque(d):-585 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1103 BSR(i):0 BSL(j):011

This picture can be misleading since the connector is upside down on it?
https://github.com/joshwardell/CANserver/blob/master/docs/img/singledisplay.jpg

Model 3 LR AWD with software 2020.24.6


----------



## JWardell

Mr.K said:


> So, i started playing with the new toys. And some questions/comments came up.
> I have the e-mobility obd cable that work with the OBD reader and i suppose that it also should power the CANserver? Mine doesn't, i need to have the usb plugged in to power it.
> 
> How do you send a triple digit negative value to the display? Negative removes first digit, positive removes the decimal. -1010 comes out as -01.0, 1010 comes out as 101.
> 
> "BattAmps" value flips the sign at 819 A, which is less than what the car draws at full throttle. But i see that the code is changed in the latest version, will try that tomorrow.
> 
> BattAmps(a):62 BattVolts(b):389 BattPower(c):241 RearTorque(d):492 MinBattTemp(e):32 MaxRegen(f):78 MaxDisChg(g):431 VehSpeed(h):552 BSR(i):0 BSL(j):011
> BattAmps(a):234 BattVolts(b):381 BattPower(c):891 RearTorque(d):1525 MinBattTemp(e):32 MaxRegen(f):78 MaxDisChg(g):431 VehSpeed(h):571 BSR(i):0 BSL(j):011
> BattAmps(a):604 BattVolts(b):363 BattPower(c):2192 RearTorque(d):2950 MinBattTemp(e):32 MaxRegen(f):79 MaxDisChg(g):431 VehSpeed(h):631 BSR(i):0 BSL(j):011
> BattAmps(a):760 BattVolts(b):354 BattPower(c):2690 RearTorque(d):3172 MinBattTemp(e):32 MaxRegen(f):80 MaxDisChg(g):430 VehSpeed(h):728 BSR(i):0 BSL(j):011
> BattAmps(a):-723 BattVolts(b):346 BattPower(c):-2501 RearTorque(d):3130 MinBattTemp(e):32 MaxRegen(f):82 MaxDisChg(g):430 VehSpeed(h):824 BSR(i):0 BSL(j):011
> BattAmps(a):-673 BattVolts(b):343 BattPower(c):-2308 RearTorque(d):2827 MinBattTemp(e):32 MaxRegen(f):84 MaxDisChg(g):430 VehSpeed(h):923 BSR(i):0 BSL(j):011
> BattAmps(a):-673 BattVolts(b):342 BattPower(c):-2301 RearTorque(d):2570 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1010 BSR(i):0 BSL(j):011
> BattAmps(a):-667 BattVolts(b):341 BattPower(c):-2274 RearTorque(d):2332 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1087 BSR(i):0 BSL(j):011
> BattAmps(a):124 BattVolts(b):381 BattPower(c):472 RearTorque(d):547 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1136 BSR(i):0 BSL(j):011
> BattAmps(a):-118 BattVolts(b):395 BattPower(c):-466 RearTorque(d):-532 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1128 BSR(i):0 BSL(j):011
> BattAmps(a):-120 BattVolts(b):396 BattPower(c):-475 RearTorque(d):-585 MinBattTemp(e):32 MaxRegen(f):85 MaxDisChg(g):429 VehSpeed(h):1103 BSR(i):0 BSL(j):011
> 
> This picture can be misleading since the connector is upside down on it?
> https://github.com/joshwardell/CANserver/blob/master/docs/img/singledisplay.jpg
> 
> Model 3 LR AWD with software 2020.24.6


Very glad it made it all the way to Sweden 

The OBD should power it. Do you have the power switch on the side off?

Considering the negative is another digit, that's probably too many digits to fit on the display. What are you trying to show with such large negative values? You could, for example, switch to Kilo-values, so on the server if value > 1000 then divide by 1000 and display a K in the units.

Sounds like a problem on the decoding side, they probably recently changed the CAN signals again.
I plan to do some DBC updates this weekend and will also look carefully in the server decoding software.

Good catch on the picture, with the connector backwards!


----------



## Mr.K

The CANserver power up fine when i hook up the white and yellow wires to a power supply but not in the car. Looks like you are using pin-5 (signal ground) and e-mobility pin-4 (chassis ground). The OBD2 readers i have has connection between pin 4 and 5, so the solution would be to connect them together on yours.

Noticed the missing digit for battery power while supercharging and i then added battery amps to another display.


----------



## JWardell

Mr.K said:


> The CANserver power up fine when i hook up the white and yellow wires to a power supply but not in the car. Looks like you are using pin-5 (signal ground) and e-mobility pin-4 (chassis ground). The OBD2 readers i have has connection between pin 4 and 5, so the solution would be to connect them together on yours.
> 
> Noticed the missing digit for battery power while supercharging and i then added battery amps to another display.


Both 4 and 5 should be connected to ground, so one isn't on your harness? I could just wire it to the other. Are you able to open it and move the wire over?
I do plan to make an actual board for that OBD box so I'm not soldering individual wires.


----------



## Mr.K

JWardell said:


> Both 4 and 5 should be connected to ground, so one isn't on your harness? I could just wire it to the other. Are you able to open it and move the wire over?
> I do plan to make an actual board for that OBD box so I'm not soldering individual wires.


If you are talking about your harness they are not connected. Haven't checked the car, but I'm pretty sure there is no gnd on pin 5 there since it doesn't work. 
But it's no problem, should be an easy fix.


----------



## JWardell

Mr.K said:


> If you are talking about your harness they are not connected. Haven't checked the car, but I'm pretty sure there is no gnd on pin 5 there since it doesn't work.
> But it's no problem, should be an easy fix.
> View attachment 34805


Sorry, I meant on your console to OBD harness I would expect both pins to be grounded, so I am only wiring to one of them. So if you can solder for a few seconds try moving the wire to the other pin, well I should recommending applying new solder for a bit to the new pin before moving the wire.


----------



## REGuy

Where would I find the schematic for the ESP32 CAN shield ?

For the purpose of sniffing and message injection, wouldn't a USB device connected directly to a PC with appropriate hardware be more versatile ?
https://canable.io/

Don't get me wrong, I like the idea of it being wireless and I like ESP32s... also... what do you think of installing https://github.com/candle-usb/candleLight_fw on it ? Would have to be modified to work with WiFi. There are lots of good open source Linux tools then available. The thing about OS tools is if they don't do what you want/need, you can modify them so they do. With closed source you are "stuck" with what the vendor gives you.

For dev purposes, AFAIAC, would be great if this thing interfaced with python-can or something similar. https://python-can.readthedocs.io/en/master/api.html

Thoughts ?


----------



## kornerz

REGuy said:


> Where would I find the schematic for the ESP32 CAN shield ?
> 
> For the purpose of sniffing and message injection, wouldn't a USB device connected directly to a PC with appropriate hardware be more versatile ?
> https://canable.io/
> 
> Don't get me wrong, I like the idea of it being wireless and I like ESP32s... also... what do you think of installing https://github.com/candle-usb/candleLight_fw on it ? Would have to be modified to work with WiFi. There are lots of good open source Linux tools then available. The thing about OS tools is if they don't do what you want/need, you can modify them so they do. With closed source you are "stuck" with what the vendor gives you.
> 
> For dev purposes, AFAIAC, would be great if this thing interfaced with python-can or something similar. https://python-can.readthedocs.io/en/master/api.html
> 
> Thoughts ?


Raspberry Pi 3 + https://www.makerfabs.com/can-module-mcp2515.html works pretty good for me - allowing full stack of Linux tools to be used with CAN interface.


----------



## REGuy

kornerz said:


> Raspberry Pi 3 + https://www.makerfabs.com/can-module-mcp2515.html works pretty good for me - allowing full stack of Linux tools to be used with CAN interface.


Yes. One can do just about anything with a couple devices like that and an RPi. An RPi is many times more powerful than most Arduinos and you have a whole OS full of tools and structure behind you when you are working.

As far as the interface to the CAN module itself, I like the rawer the better because there is less stuff to get in the way. It doesn't get much rawer than SPI. The only thing about using Linux is that it isn't a RT OS, so something like sending periodic messages isn't the best because the OS can interfere with the timing.

Kornerz: which SPI driver are you using ? What speed are you talking to the CAN module ? What distro/tools are you using on the RPi ?


----------



## JWardell

REGuy said:


> Where would I find the schematic for the ESP32 CAN shield ?
> 
> For the purpose of sniffing and message injection, wouldn't a USB device connected directly to a PC with appropriate hardware be more versatile ?
> https://canable.io/
> 
> Don't get me wrong, I like the idea of it being wireless and I like ESP32s... also... what do you think of installing https://github.com/candle-usb/candleLight_fw on it ? Would have to be modified to work with WiFi. There are lots of good open source Linux tools then available. The thing about OS tools is if they don't do what you want/need, you can modify them so they do. With closed source you are "stuck" with what the vendor gives you.
> 
> For dev purposes, AFAIAC, would be great if this thing interfaced with python-can or something similar. https://python-can.readthedocs.io/en/master/api.html
> 
> Thoughts ?


I know many folks using the Canable, including with python and a Pi...it works very well. Certainly great for live computer analysis. But that is a somewhat different purpose than a dedicated logger and wifi transmitter. The CANserver is only one of dozens of CAN tools in my shed


----------



## kornerz

REGuy said:


> Kornerz: which SPI driver are you using ? What speed are you talking to the CAN module ? What distro/tools are you using on the RPi ?


My setup is described in detail here: https://teslaownersonline.com/threads/realtime-model-3-can-data-dashdboard.15651/
In short, stock Raspbian + realtime kernel + few interrupt priority adjustments allow to read Tesla vehicle CAN bus data at full 500k speed. Writing to the bus is also possible, which I use to wake the car (no Tesla LTE coverage here for remote wake)


----------



## REGuy

kornerz said:


> My setup is described in detail here: https://teslaownersonline.com/threads/realtime-model-3-can-data-dashdboard.15651/
> In short, stock Raspbian + realtime kernel + few interrupt priority adjustments allow to read Tesla vehicle CAN bus data at full 500k speed. Writing to the bus is also possible, which I use to wake the car (no Tesla LTE coverage here for remote wake)


Wow, you nailed it ! Bonus points for using a RT kernel on the RPi.

2 questions:

1) How well would the RPi work with 2 CAN interfaces as a receiver/transmitter to intercept and/or change messages on a bus ? Would it be fast enough ?

2) How does the speed of the RPi running Linux compare to using a stand alone processor such as an ESP32, if you were just reading the CAN messages and spewing them on the WiFi interface ? Could an ESP32 do it ?


----------



## REGuy

JWardell said:


> I know many folks using the Canable, including with python and a Pi...it works very well. Certainly great for live computer analysis. But that is a somewhat different purpose than a dedicated logger and wifi transmitter. The CANserver is only one of dozens of CAN tools in my shed


OK. I didn't understand that you are more interested in creating displays for Teslas rather than doing CAN message research.

I assume that CANserver uses the MCP2515 ? And if I wired an MCP2515 module to the right pins on an ESP32, I could run/test and develop code for your project ?


----------



## kornerz

> 1) How well would the RPi work with 2 CAN interfaces as a receiver/transmitter to intercept and/or change messages on a bus ? Would it be fast enough ?
I have not tried attaching secod MCP2515, but on Pi3 my setup takes 40-50% of CPU time on the first core. It may be sufficient for less busy second bus, but you may as well need a Pi 4 to handle that.

2) How does the speed of the RPi running Linux compare to using a stand alone processor such as an ESP32, if you were just reading the CAN messages and spewing them on the WiFi interface ? Could an ESP32 do it ?
I have not tried it, but if ESP32 filters only needed messages - that would definitely do.


----------



## REGuy

kornerz said:


> > 1) How well would the RPi work with 2 CAN interfaces as a receiver/transmitter to intercept and/or change messages on a bus ? Would it be fast enough ?
> I have not tried attaching secod MCP2515, but on Pi3 my setup takes 40-50% of CPU time on the first core. It may be sufficient for less busy second bus, but you may as well need a Pi 4 to handle that.


Wow, I'm surprised it takes that much power. But you are also doing the web stuff on your Pi.



> 2) How does the speed of the RPi running Linux compare to using a stand alone processor such as an ESP32, if you were just reading the CAN messages and spewing them on the WiFi interface ? Could an ESP32 do it ?
> I have not tried it, but if ESP32 filters only needed messages - that would definitely do.


I would need it to spew every message it receives. It could spew them raw without reformatting.


----------



## kornerz

REGuy said:


> Wow, I'm surprised it takes that much power. But you are also doing the web stuff on your Pi.


"Web stuff" does not take much of CPU power. However, I am using less than optimal method to parse CAN messages: standalone "candump" utility reads them from can0 interface and then a Perl script parses its output for data.
There should be better ways to do it, with less CPU power.



REGuy said:


> I would need it to spew every message it receives. It could spew them raw without reformatting.


What would you do with that? On vehicle bus, we can see ~300 different message IDs.
Only ~100 of these are decoded by efforts of *JWardell *and others, and only subset of these are usable. For my dashboard of "everything I could think of", only 40 messages are used.

P.S.: Looks like we hijacked a thread here.


----------



## REGuy

kornerz said:


> "Web stuff" does not take much of CPU power. However, I am using less than optimal method to parse CAN messages: standalone "candump" utility reads them from can0 interface and then a Perl script parses its output for data.
> There should be better ways to do it, with less CPU power.


Candump is written in C and should be fairly efficient. I haven't looked at the source.

Perl, on the other hand...



> What would you do with that? On vehicle bus, we can see ~300 different message IDs.
> Only ~100 of these are decoded by efforts of *JWardell *and others, and only subset of these are usable. For my dashboard of "everything I could think of", only 40 messages are used.


To figure out what messages are needed to control the drive units. And various other things. I'd spew them out for processing on a more powerful computer, possibly log them. Possibly log video simultaneously.



> P.S.: Looks like we hijacked a thread here.


My apologies to the OP.

Feel free to continue CAN sniffing discussions here:
https://teslaownersonline.com/threa...e-motors-with-can-messages.16568/#post-288782


----------



## JWardell

REGuy said:


> OK. I didn't understand that you are more interested in creating displays for Teslas rather than doing CAN message research.
> 
> I assume that CANserver uses the MCP2515 ? And if I wired an MCP2515 module to the right pins on an ESP32, I could run/test and develop code for your project ?


I've been doing Tesla "CAN message research" for years already. That's covered in the other thread and still discussed there.

The topic of this thread is specifically to discuss the CANserver software development.
But I highly encourage further discussion of the PI etc, which you can continue there or start a more specific thread.


----------



## REGuy

JWardell said:


> I've been doing Tesla "CAN message research" for years already. That's covered in the other thread and still discussed there.
> 
> The topic of this thread is specifically to discuss the CANserver software development.
> But I highly encourage further discussion of the PI etc, which you can continue there or start a more specific thread.


I appreciate the work you've done and the information you've shared. Thanks for replying to my posts.

I'm a newbie with Tesla cars. I'm going to read the thread you provided before I start asking questions.

I'm open to discussing CAN tools (interfaces) and/or Pi/ Arduino SBCs and their use in these projects.


----------



## JWardell

I just pushed a Server update to adapt the speed display to user MPH/KPH settings, as needed for some folks ordering in europe.

But what was unexpected is UIspeedUnits in 257 did NOT toggle when I switched it in the UI, though the UI changed to KPH; SpeedUnits stayed set to MPH. Instead I found UI_distanceUnits which does echo the actual toggle under Display settings.

But I'm a little nervous about that, will it work the same way in Canadian or European cars? Would love for someone out there to test.


----------



## kornerz

JWardell said:


> I just pushed a Server update to adapt the speed display to user MPH/KPH settings, as needed for some folks ordering in europe.
> 
> But what was unexpected is UIspeedUnits in 257 did NOT toggle when I switched it in the UI, though the UI changed to KPH; SpeedUnits stayed set to MPH. Instead I found UI_distanceUnits which does echo the actual toggle under Display settings.
> 
> But I'm a little nervous about that, will it work the same way in Canadian or European cars? Would love for someone out there to test.


Looked at one of my dumps, EU car with UI speed in KPH shows the signal also in KPH:


Code:


(1581663732.111030)  can0  257   [8]  1D 1E 31 17 5E 00 00 00 ::
ID257DI_speed(
    DI_speedChecksum: 29,
    DI_speedCounter: 14,
    DI_vehicleSpeed: 22.8 kph,
    DI_uiSpeed: 23,
    DI_uiSpeedUnits: 'DI_SPEED_KPH',
    DI_uiSpeedHighSpeed: 23
)


----------



## JWardell

kornerz said:


> Looked at one of my dumps, EU car with UI speed in KPH shows the signal also in KPH:
> 
> 
> Code:
> 
> 
> (1581663732.111030)  can0  257   [8]  1D 1E 31 17 5E 00 00 00 ::
> ID257DI_speed(
> DI_speedChecksum: 29,
> DI_speedCounter: 14,
> DI_vehicleSpeed: 22.8 kph,
> DI_uiSpeed: 23,
> DI_uiSpeedUnits: 'DI_SPEED_KPH',
> DI_uiSpeedHighSpeed: 23
> )


That is what I expected, but mine stays at MPH even when I toggle it, so it might be locality based instead. Do you have a distance units toggle?


----------



## kornerz

JWardell said:


> That is what I expected, but mine stays at MPH even when I toggle it, so it might be locality based instead. Do you have a distance units toggle?


Yes, I have it - will try to capture data with speed set to MPH later today.


----------



## kornerz

JWardell said:


> That is what I expected, but mine stays at MPH even when I toggle it, so it might be locality based instead. Do you have a distance units toggle?


Tested.
Can confirm, on a EU car with 2020.24.6.4 firmware, if UI settings are changed to miles - message ID257 changes to DI_uiSpeedUnits: 'DI_SPEED_MPH' from 'DI_SPEED_KPH'


----------



## JWardell

Some updates...
@pyjamasam has been working very hard on a ton of great software additions and rewrite. Hopefully it will be in the main project soon!
@All About Jake is testing streaming of data to Teslax over wifi...much faster than bluetooth dongles!
And at the request of a few, I've been working on rev 2 of the hardware, which most significantly will support an optional second can bus so all data can be logged and streamed together for power users. That's still a good 3-4 weeks away, but want folks to know who are still waiting.


----------



## JWardell

Just made my first CAN log to my own CANserver, and easily downloaded with my phone and grabbed on my computer with iCloud drive! So much easier than my professional logger! I knew good things would come once I got some community software help  
I had to grab a log of 2020.24 before I installed 2020.28 that just popped up...and then I'll take another log and compare


----------



## codingoverdrive

Apart from the rear center console (vehicle bus) and under the driver's (?) seat (chassis bus) what other places are known for accessing both (vehicle and chassis) canbus networks? 

Someone mentioned a single connector in the dashboard somewhere. Does anyone know where and how this can be accessed?


----------



## JWardell

madmaxim said:


> Apart from the rear center console (vehicle bus) and under the driver's (?) seat (chassis bus) what other places are known for accessing both (vehicle and chassis) canbus networks?
> 
> Someone mentioned a single connector in the dashboard somewhere. Does anyone know where and how this can be accessed?


All three busses are accessible at the computer if you want to pull your dash apart, unplug the computer, and make a harness.
Vehicle and Chassis busses also exist on VCleft and VCright connectors, basically the other end of those harnesses. 
BUt I would not call any of those places easy.


----------



## codingoverdrive

JWardell said:


> All three busses are accessible at the computer if you want to pull your dash apart, unplug the computer, and make a harness.


Thanks for your reply - I guessed it might be hard work! 



JWardell said:


> Vehicle and Chassis busses also exist on VCleft and VCright connectors, basically the other end of those harnesses.
> BUt I would not call any of those places easy.


Do you know where they can be accessed in the car? ... relatively easily? ...


----------



## JWardell

madmaxim said:


> Thanks for your reply - I guessed it might be hard work!
> 
> Do you know where they can be accessed in the car? ... relatively easily? ...


VCleft and VCright are at the foot of the A-pillars. You can get to some of their connectors easily, but most not. Unless you have a few extra elbows, the connections I make are the easiest to access especially without ripping out several pieces of dashboard.


----------



## codingoverdrive

JWardell said:


> VCleft and VCright are at the foot of the A-pillars.


What does VCLeft and VCRight mean?

Vehicle+Chassis CANBUS's LHS of car, Vehicle+Chassis CANBUS's RHS car?



JWardell said:


> You can get to some of their connectors easily, but most not. Unless you have a few extra elbows, the connections I make are the easiest to access especially without ripping out several pieces of dashboard.


Are there connectors in these locations that would allow a custom Y-lead to access both buses? And is there space to install a canserver (or similar) behind the trim panels?

Do you have any photos from your investigations?


----------



## garsh

madmaxim said:


> What does VCLeft and VCRight mean?


Those are the Voltage Controllers on the left and right sides of the car.


----------



## JWardell

madmaxim said:


> What does VCLeft and VCRight mean?
> 
> Vehicle+Chassis CANBUS's LHS of car, Vehicle+Chassis CANBUS's RHS car?
> 
> Are there connectors in these locations that would allow a custom Y-lead to access both buses? And is there space to install a canserver (or similar) behind the trim panels?
> 
> Do you have any photos from your investigations?


Read at least the first few pages of https://teslaownersonline.com/threads/diagnostic-port-and-data-access.7502/
where we discuss all of that, and I have pictures of attempts to probe around VCleft.


----------



## codingoverdrive

I did re-read the first few pages again and specifically Post #12 and #13. Thanks for the tip.

Are you saying that both (Vehicle + Chassis) CAN signals are available at the Controller but that you think accessing under the seat and in the rear centre console is easier?

Wouldn't a dual bus CANServer be more discrete added at or near the Voltage controller? Surely it's a one off install and then fit and forget... ?


----------



## JWardell

madmaxim said:


> I did re-read the first few pages again and specifically Post #12 and #13. Thanks for the tip.
> 
> Are you saying that both (Vehicle + Chassis) CAN signals are available at the Controller but that you think accessing under the seat and in the rear centre console is easier?
> 
> Wouldn't a dual bus CANServer be more discrete added at or near the Voltage controller? Surely it's a one off install and then fit and forget... ?


As I said, it's not easy to access most of the VCleft and VCright connectors. Not quite sure how to pull off that trim, I think the entire dash needs to be removed. Also, you would need to source their connectors. And make expensive harnesses as they have dozens of wires each. And chance screwing up a *LOT* of connections. Sure, it's a great place to plug in and hide a board, but is in NO WAY approachable for the average consumer. Under the seat is much much simpler. But hey, no one is stopping you, go for it if you want to.


----------



## codingoverdrive

OK understand the issue now. That was a great reply. Thanks


----------



## JWardell

I've moved the ToDo list off the main page to its own document:
https://github.com/joshwardell/CANserver/blob/master/docs/todo.md

You might notice that almost every initial item is done, and of course I added much more for the future.

I have a lot more documentation to add to coinciding with impending software release!


----------



## Randy Spencer

OK, thanks to JWardell for all his help in setting up my own CANserver. I am still waiting for the OBD adapter to arrive so I have it hooked up under the passenger seat. I had some issues getting it to work:

Must have taken 30 attempts to connect to the CANserver, Josh suggested hooking it up in the house to a MicroUSB to do the initial setup. Tore the house apart looking for one, only to discover later that one came with the display. Ha!

It would have been nice if there were a picker for connecting to the home WiFi network, but I was able to connect much more easily inside than under the seat in the driveway.

When I tried to put the MicroSD card in the slot (sadly while the unit was still under the seat as well) I thought I broke the slot, but it turns out the SD mechanism has the card laid in place and then the cover locked on top of it. My fat fingers required removing the daughterboard on the dining room table to get it successfully locked.

I am not sure what the release mechanism is for the cables under the seat, I was unable to remove the cable that came with the CANserver from the seat plug but I was just able to unplug it from the unit itself. Now that it's back under the seat in the car all seems to be working well. Unfortunately, I haven't been able to get it to talk to TesLAX yet. My understanding was the I join the CANserver WiFi network and run the app, but there must be one more step.

I also haven't figured out how to display any data or what to do with the logged data. I figured out how to download it to my laptop and open the file, but it's like reading assembly w/o any translation or decompiling. Since I am plugged in under the seat the default example scripts don't collect any data when I use them to control the display. I am making the change to the new scripts successfully as the variable labels change, but it always is marked as 0.0 whatever's. I got the DBC list and saw all the items I could put into the display, but couldn't figure out how to format the code. I couldn't even reverse engineer the provided scripts. I know ease-of-use will come with time, but if anyone knows how to code to display something like _UI speed limit_ just so I can see something change, that would be great.

This is my first post here, I am more of a TMC man myself. I may post this there too if I can find a place.


----------



## JWardell

Randy Spencer said:


> OK, thanks to JWardell for all his help in setting up my own CANserver. I am still waiting for the OBD adapter to arrive so I have it hooked up under the passenger seat. I had some issues getting it to work:
> 
> Must have taken 30 attempts to connect to the CANserver, Josh suggested hooking it up in the house to a MicroUSB to do the initial setup. Tore the house apart looking for one, only to discover later that one came with the display. Ha!
> 
> It would have been nice if there were a picker for connecting to the home WiFi network, but I was able to connect much more easily inside than under the seat in the driveway.
> 
> When I tried to put the MicroSD card in the slot (sadly while the unit was still under the seat as well) I thought I broke the slot, but it turns out the SD mechanism has the card laid in place and then the cover locked on top of it. My fat fingers required removing the daughterboard on the dining room table to get it successfully locked.
> 
> I am not sure what the release mechanism is for the cables under the seat, I was unable to remove the cable that came with the CANserver from the seat plug but I was just able to unplug it from the unit itself. Now that it's back under the seat in the car all seems to be working well. Unfortunately, I haven't been able to get it to talk to TesLAX yet. My understanding was the I join the CANserver WiFi network and run the app, but there must be one more step.
> 
> I also haven't figured out how to display any data or what to do with the logged data. I figured out how to download it to my laptop and open the file, but it's like reading assembly w/o any translation or decompiling. Since I am plugged in under the seat the default example scripts don't collect any data when I use them to control the display. I am making the change to the new scripts successfully as the variable labels change, but it always is marked as 0.0 whatever's. I got the DBC list and saw all the items I could put into the display, but couldn't figure out how to format the code. I couldn't even reverse engineer the provided scripts. I know ease-of-use will come with time, but if anyone knows how to code to display something like _UI speed limit_ just so I can see something change, that would be great.
> 
> This is my first post here, I am more of a TMC man myself. I may post this there too if I can find a place.


Many features are certainly quite advanced and not for everyone. Logging and display capabilities are completely independent. Scripts define what data is sent to the display. The logs simply record ALL data. Perhaps in the future we might be able to add filtering for the logs, but for now they are intended for those interested in post processing all data for their purposes, and that almost always involves opening and processing the log files with CAN analysis software such as SavvyCAN. My hope is we might get folks from other utilities involved and they can add the ability for data processors such as TeslaFi and Teslogger to automatically pull data logs and process them.

As for TesLax, you must first connect to the CANserver wifi with your iphone, then Open Teslax and in its conncection settings, you will see a Panda option. If you enter the CANserver address 192.168.4.1 while connected to it, and the connect button, you should start seeing data. (However, I believe most of the free data items that TesLax views require connection to the Vehicle CAN bus through OBD, do not exist on the chassis can bus).

The chassis connectors have a tab that you squeeze in, and then you can pull the connector out. You could practice plugging the CANserver's cable into its own socket.


----------



## Randy Spencer

Thanks for the info, I should have been able to figure out the Panda thing.

I am still curious how to script the display output. I get the basics, but I cannot find any documentation on what the syntax is. The examples use this syntax:

local localVar = CANServer_getAnalysisVar("SystemVar")

The example SystemVars are: BattVolts, BattAmps, RearTorque, FrontTorque, BSR, BSL, VehSpeed, DistanceUnitMiles, Range, uSOE, MinBattTemp, battTempPct, EnergyRemaining, FullPackEnergy

I tried them all and they must all be on the Vehicle CANbus, not the Chassis CANbus that I am hooked into

The popular CAN messages listed on the Wiki (https://github.com/joshwardell/CANserver/wiki/BusComparison) do not map to any of those SystemVars:

*V C ID signals*
X X 00C UI audio display
X X 04F GPS loc
X 101 RCM pitch roll yaw
X X 108 Rear Tourqe -diff?
X 111 RCM lat lon vert accel
X X 118 pedal gear
X 126 Rear V A
X X 129 Steering angle
X 132 BMS V A
X 185 Brake Torque
X 1D8 Rear Torque -diff?
X 219 TPMS press temps
X X 229 Gear lever
X 238 UI speedlimit
X X 249 left stalk
X 252 BMX discharge regen heat
X X 257 speedometer
X 261 12v batt V A AH
X 264 charger V A W
X 266 Rear power heat
X 268 system power regen heat
X 287 PTC
X 292 BMS SOCs packenergy
X X 2B4 PCS V A
X 2D2 minmax V A
X 312 BMS temps
X X 318 date time
X 31F TPMS press temps
X 332 BMS brick minmax V T
X 336 power regen rating
X 33A UI range SOC
X 352 BMS energy remaining full
X X 399 DAS BSD speedlimit
X 3A1 VCfront driverpresent
X 3D8 elevation
X X 3D9 GPS heading speed limit
X X 3FE brake T
X X 7FF GTW config

I have also not found a match in the .DBC file for the Model 3: https://github.com/joshwardell/model3dbc/blob/master/Model3CAN.dbc


----------



## pyjamasam

Randy Spencer said:


> ...
> 
> local localVar = CANServer_getAnalysisVar("SystemVar")
> 
> The example SystemVars are: BattVolts, BattAmps, RearTorque, FrontTorque, BSR, BSL, VehSpeed, DistanceUnitMiles, Range, uSOE, MinBattTemp, battTempPct, EnergyRemaining, FullPackEnergy
> 
> I tried them all and they must all be on the Vehicle CANbus, not the Chassis CANbus that I am hooked into
> ...


VehSpeed should available on both the Chassis and Vehicle busses. VehSpeed is our friendly name (as defined in the analysis screen). It's in CAN frame 0x257. And it maps to UIspeed_signed257 (based on the start bit, bit length, etc) from the DBC file.

If you set one of your microDisplays to be display 2 (thats having a jumper on the middle pair of the 3 pairs of pins on the back) you should get the speed display. (if you have the default scripts defined, and the default analysis items defined).

chris.


----------



## Randy Spencer

Ah, of course, this was all done in my driveway so I never generated a speed over 0.0. That makes so much more sense. I saw the Analysis Signals on the Demo Scripts page, but did not understand what I was looking at on the Analysis tab page of the CANServer. It makes much more sense now. Thanks, that should be enough to get me started. Gonna go for a drive and see if it shows my speed now.


----------



## Mr.K

Is front power and torque moved in 2020.36.11?
I’m getting 0 on both with CANserver and tesLAX after updating. 
2E5 & 1D5


----------



## JWardell

Mr.K said:


> Is front power and torque moved in 2020.36.11?
> I'm getting 0 on both with CANserver and tesLAX after updating.
> 2E5 & 1D5


Someone with an AWD car is going to have to confirm...


----------



## Randy Spencer

OK, so I am just curious about reading the .DBC file for the TM3. On the Bus Comparison page of the CANServer Wiki I see some items listed as being on BOTH busses. I can search for them in the .DBC which has the buss listed for the individual signal sets. But I only see one Hex ID for each of these. How can one tell if a signal is on both busses or what the ID is on the other buss?

I spent some time with TesLAX poking around with adding fields to the interface with VERY mixed results. Cannot tell from it's interface which buss things are on.


----------



## JWardell

Randy Spencer said:


> OK, so I am just curious about reading the .DBC file for the TM3. On the Bus Comparison page of the CANServer Wiki I see some items listed as being on BOTH busses. I can search for them in the .DBC which has the buss listed for the individual signal sets. But I only see one Hex ID for each of these. How can one tell if a signal is on both busses or what the ID is on the other buss?
> 
> I spent some time with TesLAX poking around with adding fields to the interface with VERY mixed results. Cannot tell from it's interface which buss things are on.


Ultimate the only way to tell which bus each message is on, is to connect to and log each bus, which every software update. Tesla is always changing CAN data. It's a lot of work to keep up with it.
The easier way is to...ask me 
For the most part in the DBC, I label everything with VehicleBus, and signals that ONLY appear on the ChassisBus are labeled as such. But thee are just my observances at the time I was adding the signal.
For example blind spot message used to only be on chassis. It moved over to both at some point this year.


----------



## Randy Spencer

Wow! I just finished reading thru the entire .DBC and I cannot imagine how all that data was gleaned. I assume it's more than just poking a location and peeking the results and then moving on to the next byte. Every bit is accounted for including the offset that the car uses to display the unsigned integer value that goes slightly into the negative.

All the possible values are listed on the line along with units for the values. Though I am not sure why all the value lines end with the word receiver.

I got a bunch of values into TesLAX, but I have been having trouble scripting a value into the microdisplay. I finally got the BattCoolantTemp in, then trying to convert it into Fahrenheit but I caused the CANServer to shut down when it encountered my script error. I got a big Script Error message on screen but then the screen went black and the CANServer WiFi went away. I ended up having to pull it out and press the reset button to regain control. Crazy.


----------



## JWardell

Randy Spencer said:


> Wow! I just finished reading thru the entire .DBC and I cannot imagine how all that data was gleaned. I assume it's more than just poking a location and peeking the results and then moving on to the next byte. Every bit is accounted for including the offset that the car uses to display the unsigned integer value that goes slightly into the negative.
> 
> All the possible values are listed on the line along with units for the values. Though I am not sure why all the value lines end with the word receiver.
> 
> I got a bunch of values into TesLAX, but I have been having trouble scripting a value into the microdisplay. I finally got the BattCoolantTemp in, then trying to convert it into Fahrenheit but I caused the CANServer to shut down when it encountered my script error. I got a big Script Error message on screen but then the screen went black and the CANServer WiFi went away. I ended up having to pull it out and press the reset button to regain control. Crazy.


You can just do the math inline, as I do in the advanced battery info example script
CANServer_getAnalysisVar("MinBattTemp")*1.8+32 .. "F "

Actually I now just have my battery temp in my right display (as seen in my latest tweet) which I realized I was more interested in than torque.


----------



## michi84

Mr.K said:


> Is front power and torque moved in 2020.36.11?
> I'm getting 0 on both with CANserver and tesLAX after updating.
> 2E5 & 1D5


On my AWD, 2E5 is there as before, 1D5 also. Recorded and displayed with tesLAX, Jwardells latest DBC from July.


----------



## Randy Spencer

JWardell said:


> You can just do the math inline, as I do in the advanced battery info example script
> CANServer_getAnalysisVar("MinBattTemp")*1.8+32 .. "F "
> 
> Actually I now just have my battery temp in my right display (as seen in my latest tweet) which I realized I was more interested in than torque.


One of my attempts was to copy that math. Sadly the Battery Coolant Temp variable I was trying to display failed that math. I was smart enough to combine the *1.8 with the *10 that was required to just show the variable in Celcius. I then added the 32 degrees and it only incremented by less than 5. I was trying to make sure the math was being done in the correct order with parenthesis when I created the error w/ mismatched parens. I tried to reset it by letting the car sit, but that didn't fix it. So I had to take the CANServer out from under the seat and press the reset button. That's gonna be harder now that I have screwed the case together.

I got the OBD adapter today and moved the CANServer from under the seat so I had to put the screws in. But I did finally figure out the math, just had to add 320 since the figure was gonna be divided by 10 when it's displayed. So silly.

I am curious why my clone of your tesLAX display looks so different from yours on YouTube as much as 7 months ago. Did you get a special version? Like my BattPower has the name below not in the graph itself:


----------



## JWardell

Randy Spencer said:


> One of my attempts was to copy that math. Sadly the Battery Coolant Temp variable I was trying to display failed that math. I was smart enough to combine the *1.8 with the *10 that was required to just show the variable in Celcius. I then added the 32 degrees and it only incremented by less than 5. I was trying to make sure the math was being done in the correct order with parenthesis when I created the error w/ mismatched parens. I tried to reset it by letting the car sit, but that didn't fix it. So I had to take the CANServer out from under the seat and press the reset button. That's gonna be harder now that I have screwed the case together.
> 
> I got the OBD adapter today and moved the CANServer from under the seat so I had to put the screws in. But I did finally figure out the math, just had to add 320 since the figure was gonna be divided by 10 when it's displayed. So silly.
> 
> I am curious why my clone of your tesLAX display looks so different from yours on YouTube as much as 7 months ago. Did you get a special version? Like my BattPower has the name below not in the graph itself:
> 
> View attachment 35731
> View attachment 35733


You should multiply by 10 after the math, so yes you were effectively only adding 3.2

@All About Jake has made many great updates to TesLax in recent months and the guages have changed since that video. It keeps getting better and better IMO. But he also welcomes feedback!

Also not quite sure why you needed to press the reset button. The server should just display an error if there is a problem with a display script. If and when it does crash, you can always just toggle the power switch on the side of the case.


----------



## Mr.K

Any tips on the SD card?
I have figured out how to open the holder an place the card right. I have tried two uSD cards with different formatting, one old 2GB (FAT and FAT32) and one new 64GB (exFAT and FAT32), But i still get "No SD card present. Logging disabled", same on both CANservers. Running the Release 1 from August 12.


----------



## JWardell

Mr.K said:


> Any tips on the SD card?
> I have figured out how to open the holder an place the card right. I have tried two uSD cards with different formatting, one old 2GB (FAT and FAT32) and one new 64GB (exFAT and FAT32), But i still get "No SD card present. Logging disabled", same on both CANservers. Running the Release 1 from August 12.


Folks seem confused by the old style hinge SD carrier. The top metal slides back and forth to lock and unlock. Once you have it open, you have to place the card so it aligns, then close the hinge, then slide it so it stays locked closed.


----------



## Mr.K

JWardell said:


> Folks seem confused by the old style hinge SD carrier. The top metal slides back and forth to lock and unlock. Once you have it open, you have to place the card so it aligns, then close the hinge, then slide it so it stays locked closed.


Yes, i have done that. But it doesn't show up under logging.


----------



## JWardell

Hmm. I'm not sure if FAT32 is supported, or even the large size, but the 2GB card should certainly work. Any ideas @pyjamasam ?


----------



## pyjamasam

JWardell said:


> Hmm. I'm not sure if FAT32 is supported, or even the large size, but the 2GB card should certainly work. Any ideas @pyjamasam ?


Fat32 should work. Larger cards should work as well (I mean I have tried up to a 16GB during development). I don't think exFAT will work.

In the past I have used the SD Card Formatter from the SD Association to nuke a card that was misbehaving. Maybe give that a go. It formats things as per the SD Association's specs (the SD/FAT implementation thats being used on the CANServer might not be as robust as the ones on a normal computer, so it may be tripping over something subtle)

A single partition, with the partition table being MBR (which should be what windows does by default, macs have an option to select it) is required though.

chris.


----------



## JWardell

Server V2 has been shipping, here's a walkthrough of the new features


----------



## Randy Spencer

This is exciting. I sent you a message from your website commenting that the new unit was not available yet. Not sure if it went thru.

I am curious what will happen to people who want to have one in each car now that I am buying my second one? Since they have the same name on the WiFi will there be a way to distinguish them? Also, any danger in other people knowing what the password is to the CanServer (since it's immutable)? I guess they could change the logging or erase my SD card from their browser.

Looking forward to getting the new unit! Now I gotta buy another SD card, I should have gotten more initially.


----------



## JWardell

Randy Spencer said:


> This is exciting. I sent you a message from your website commenting that the new unit was not available yet. Not sure if it went thru.
> 
> I am curious what will happen to people who want to have one in each car now that I am buying my second one? Since they have the same name on the WiFi will there be a way to distinguish them? Also, any danger in other people knowing what the password is to the CanServer (since it's immutable)? I guess they could change the logging or erase my SD card from their browser.
> 
> Looking forward to getting the new unit! Now I gotta buy another SD card, I should have gotten more initially.


Actually just added is the feature to modify the wifi name and password of the server. Some may want that for security. However, they are coded into the displays. Displays can however be configured to a Canserver2 network...so you could take advantage of that for two cars.


----------



## Randy Spencer

I'll have to live with it all as CanServer for now. The displays are staying in the TM3. The second car is an iMiev so it won't have power when the car is off. Would like a display in the iMiev, but it doesn't have the slot to place the displays in. Hopefully, other display options are in our future.


----------



## Eugenius

@JWardell du you need help with SMT BT integration?
I've already done it in a simple way:
https://github.com/Adminius/ESP32-ScanMyTesla


----------



## Randy Spencer

But WiFi is so much faster, BT is a bottleneck for reading CANbus ("lots of people are saying")


----------



## pyjamasam

Eugenius said:


> @JWardell du you need help with SMT BT integration?
> I've already done it in a simple way:
> https://github.com/Adminius/ESP32-ScanMyTesla


We've been chatting with @amund7 about getting support into SMT for the panda protocol (and the evolved protocol that supports filtering) via wifi mainly due to the volume of data thats now possible to send.



Randy Spencer said:


> But WiFi is so much faster, BT is a bottleneck for reading CANbus ("lots of people are saying")


Running both busses (Vehicle and Chassis) on my Model 3 produces about 110KB/s of data using the panda binary protocol (for somewhere in the neighbourhood of 5600 frames/s).

Bluetooth low energy specs peg the speeds at about 0.3Mb/s for 4.0/4.1, 0.8Mb/s for 4.2 and 1.4Mb/s for 5.0

So it looks like we would fall right about at the BLE 4.2 limit. But thats the upper limit of a connection. It's tough to achieve those speeds in the real world. 5.0 gives us more hope, but then both bits of hardware need to be 5.0... And the ESP is 4.2 :-(

Bluetooth classic has a little more headroom (It starts around 1Mb/s and goes up to about 3Mb/s), but it's still in the realm of "tough in the real world cause radio waves = literal magic". I say tough, but not impossible.

Thats if we use the binary panda protocol. 
The panda protocol takes a fixed 16 bytes per frame. It's kinda inefficient. It includes a length, but still pads the packet.

If we use the ELM/ST command set that SMT already supports we start having to move data around as ascii.
Looks like as an example sending a 8 byte CAN frame would take 19 bytes, so not that much larger. And shorter frames would be smaller cause the packets aren't padded like with the panda protocol. But those extra 3 bytes per frame could bite us. At 5600/s that could turn into an extra ~17KB/s. If the gods of averaging are in our corner we might break even as compared to the panda protocol, and be able to sneak in under that 800Kb/s upper limit that BLE 4.2 has... But then of course the real world still kicks in. It would be an interesting experiment. I might try to see if I can make the hardware do it. @Eugenius I might start with some of your protocol parsing code and see where I land 

But we KNOW that wifi can sustain those kinda rates easily. So thats the path we went down with the CANServer.
Wifi also gives us the ability to have the Web configuration setup we have for all the other features (like logging and onboard analysis and scripting).

I think once SMT has support for the wifi and panda protocol stuff this all might ending up being a purely academic discussion any way . hehe.
We are doing all we can to help @amund7 get to that goal!

chris.


----------



## Eugenius

WiFi is faster and more flexible solution if you transfer all IDs without filtering. But has downsides also:
Smartphone needs WIFI Connection to CANServer. 
1. CANServer is AP, Smartphone is a client, in this case most Smartphones shows "no internet connection" and will not connect or it connects, but other Apps, like WhatsApp doesnt work in this time.
2. Hotspot on Smartphone, CANServer is Client. But, iOS doesn't have Hotspot option on some tariff plans. Another problem is: Hotspot drains battery a lot :/

BLE is for SMT better solution, but also not supported by SMT yet.
I would say we can start with BT Classic.
With ST1110 protocol SMT can set filters, so that only relevant IDs will be send to Smartphone. With this approach I get up to 750packets/second and it is on single core... not really optimized. It is more than enough because for "all tab" in SMT it uses around 25-30 IDs only.
The longest message is 2byte ID, 8byte payload and onebyte "new line character". Only 11 bytes.


----------



## pyjamasam

Eugenius said:


> ...1. CANServer is AP, Smartphone is a client, in this case most Smartphones shows "no internet connection" and will not connect or it connects, but other Apps, like WhatsApp doesn't work in this time....


We handle this with the CANServer. The DHCP server doesn't send a router advertisement. So the phone doesn't get a route it thinks can get it to the internet, and stays connected to your cellular connection correctly for that, while still be able to access the CANServer via its private wifi network.



Eugenius said:


> The longest message is 2byte ID, 8byte payload and onebyte "new line character". Only 11 bytes.


Your code pads out the IDs to 3 characters, and the payload has each byte padded to two characters. I did forget the \n at the end, so its actually 20 bytes in that case for a frame with an 8 byte payload.

Though in all this I am not saying the bluetooth stuff is bad just cause its bluetooth. It does the job, and when the client application implements the filtering correctly then away we go.

We just made a design choice with the CANServer to make it wifi based. TesLax is supporting it already, and hopefully SMT will be supporting it soon.

chris.


----------



## JWardell

Chris is right. Bluetooth has always been a slog, and as you know even Tesla has regular issues with Bluetooth both in the computer as well as car keys. It is in no way suitable for high bandwidth or reliable data.

The internet on your phone has always continued to work while connceted to the cansever wifi. You phone knows it does not provide internet, and just an accessory connection. Lots of well-made accessories do the same such as my camera. In fact up until last year, all iOS OBDII dongles were wifi as well.

I'm already completely stunned at the capabilities that Chris has managed to pry out of this little embedded processor, which I only intended to feed data to my displays and hopefully save some logs, and we continue to tweak and add small features. I do fear that Bluetooth may be the elephant that breaks the camel's back, but maybe we can make it optional.

I will say I delayed this project nearly a year wrestling with a way to use bluetooth but there is so little out there for BT host, so it is awesome that you have it working. It enables a simple, inexpensive, and hopefully way more reliable solution to connect to a number of existing OBD apps compared to the existing off the shelf solutions.


----------



## Eugenius

Don't get me wrong, I'm also for WIFI instead of BT. But I think @amund7 has now other priorities (like bringing iOS version functionality Android version level). 
That's why I'm saying it make sense to use BT at this moment.


----------



## amund7

Just wanted to throw in my $.02 Molotov 

Scan My Tesla knows just 37 packets for Model 3 currently, probably similar for S.
Scan My Tesla filters out the packets it needs according to which tab you're on, Teslalogger and log settings etc.
OBDLINK (bluetooth classic) can get 950-1100 packets per second at best
Screen refresh limited to 60 Hz, and let's say you can fit maximum 20 signals on the screen. Worst case 1 signal per packet
20*60 = 1200, so yep, that's just below 60 Hz. And quite few packets are 100 Hz, many are 10 and even 1 Hz. Ok so I'm on thin ice with my math, but the point is you get the objective impression of smooth screen updates no matter how much stuff you cram in there.

I'm not against wifi, just saying, bluetooth isn't as bad as you think, for a phone app, and it's realistic use cases.
What is super bad is EVERY non-obdlink OBD2 device out there that gives as little as 50 packages per second... that gives a slow and awful looking app, and unusable logs, unless you pick out very few signals to log and view. But it's not bluetooth's fault, it's the ELM327 chips that are not made for Tesla speeds.

But for Can Server, it makes more sense to change Scan My Tesla to use wifi, than it makes sense changing CAN server to use bluetooth.
If you added bluetooth classic support to it, it would only support the Android app.
If you added BLE, I would still need to do a lot of coding, and it would only support the app I implement BLE in (which would be the IOS app)
If I manage to support Wifi, both Android (the future 2.0 branch) and IOS could hopefully support it with the same code.
When we get there, I hope it's just a matter of details to extend wifi support to OBD2 wifi devices.


----------



## amund7

Eugenius said:


> Don't get me wrong, I'm also for WIFI instead of BT. But I think @amund7 has now other priorities (like bringing iOS version functionality Android version level).
> That's why I'm saying it make sense to use BT at this moment.


True, but when pyjamasman is contributing, this can be implemented without affecting the other stuff I'm working on too much.


----------



## JWardell

My hope, as always, was to bring the brilliant minds together to help each other out, and to have everything work together as an ecosystem. The more all the software and products work together, the more powerful and easy to use they all are...and they also lend customers to each other. Mine are certainly a long way off from a product for the genera consumer (could get there some day), but to have something more powerful to offer to the geeks and data nerds. And the more the merrier.


----------



## Eugenius

@JWardell any ideas how to get Chassis Bus on post 2019 cars?
We already seen here third party displays with CAN connector to right bord computer. Maybe this were a good way to get both busses for CANServer?
Another place is somewere in right B-pillar, but you have to disassemble alot :/


----------



## JWardell

Eugenius said:


> @JWardell any ideas how to get Chassis Bus on post 2019 cars?
> We already seen here third party displays with CAN connector to right bord computer. Maybe this were a good way to get both busses for CANServer?
> Another place is somewere in right B-pillar, but you have to disassemble alot :/


I'm still trying to figure out what cars are missing the passenger seat module/harness. Only 1 or 2 people in europe apparently are missing it. It's there for most.
You can certainly tap the connector off the computer for all three busses, as Igninext does.


----------



## Eugenius

I tried to find Chassis Bus connector under passanger seat in my 2019 EU Model 3, but I don't know what to looking for


----------



## Randy Spencer

It seems from the above posts that not all the cars have it, but you are looked for the loop of cable under the seat. From there look up and toward the front of the car, you should see two plugs attached under the lip of the seat. The yellow one unplugs like a phone or ethernet plug. Same color as the port on the CanServer. Then plug that plug into the CanServer's port and plug the short wire into the lip of the seat where the other plug was.

If you don't see it send a photo of what you DO see. It may be obvious, but you can adjust the seat to it's highest high to make all this easier


----------



## JWardell

Eugenius said:


> I tried to find Chassis Bus connector under passanger seat in my 2019 EU Model 3, but I don't know what to looking for


Shown at the beginning of this video. If it's not there, then yes I would appreciate an under-seat picture, I would like to see where the wires to the seating occupancy pad go to instead.


----------



## Xxtreme

This is my LR 08.2020 EU


----------



## JWardell

Xxtreme said:


> View attachment 36712
> 
> This is my LR 08.2020 EU
> View attachment 36713
> View attachment 36714


You have the mounts for the box in the last shot, but no box. I still can't figure out why some EU cars have it and others don't. Was yours made in China?


----------



## Xxtreme

JWardell said:


> You have the mounts for the box in the last shot, but no box. I still can't figure out why some EU cars have it and others don't. Was yours made in China?


it changes yes constantly something, for example I have a loading tray in the middle standard. No the car was made in USA


----------



## Eugenius

I looked today under the passenger seat. Box with yellow socket is there, but without yellow plug 
That means, no chassis bus here, right?
MF date: 04/19/2019 EU Version Model 3 LR AWD
P.S. Thanks for CANServer installation video. It helped!


----------



## JWardell

Eugenius said:


> I looked today under the passenger seat. Box with yellow socket is there, but without yellow plug
> That means, no chassis bus here, right?
> MF date: 04/19/2019 EU Version Model 3 LR AWD
> P.S. Thanks for CANServer installation video. It helped!


Never seen that before! Strange factory build. You sure there isn't an unplugged black 4-pin connector under there somewhere?


----------



## Eugenius

JWardell said:


> Never seen that before! Strange factory build. You sure there isn't an unplugged black 4-pin connector under there somewhere?


The only unplugged plug is this one (on driver side also):


----------



## Madmolecule

*Dual Display Script Functionality*
I have tried to create a script to add additional information for a dual display set-up. I find it really provides a lot of additional information that provides more situational awareness. I have just used it for a couple of days so I would certainly like your feedback on functionality as well as how to program the same functionality more elegantly as I am not much of a programmer.

*Features:
Display Mode*

Turn displays off if car center display is off
If Vehicle Speed is = 0 Mph (stopped), display *Stoplight Mode*
If Vehicle Speed is below 5 Mph and not 0 Mph (stopped), display *Parking Mode*
If Vehicle Speed is above 5 Mph display, *Speed Limit Mode*
*Modes

Stoplight Mode*
If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
Alternate between four, 4, different displays while the vehicle is stopped. Displays alternate every 5 seconds.
Also disables turn signal indicator when stopped

*Display 1*
Time and Temperature
UTC Time converted to EST










*Display 2*
Front Left and Right Tire Pressure (PSI)










*Display 3*
Rear Left and Right Tire Pressure (PSI)










*Display 4*
Time and Range (Miles)










*Parking Mode*
When Vehicle is in Drive display Front Sensors
When Vehicle is in Reverse display Rear Sensors









Display Front Middle Left and Front Middle Right sensors on the digital display
Display Left and Right-Side Sensors on Bar Graph in Red, each LED is 2 Inches

*Speed Limit Mode*

If Vehicle Speed is above 5 Mph display, Speed Limit Mode

Displays Speed and Speed Limit

Displays Left and Right Blindspot Arrow Overlays









Displays on the bar graph One Red LED per 5 MPH above speed limit

Displays on the bar graph One Green LED per 5 MPH below speed limit

Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit








Threshold changes from 15 to 20 Mph at Speed Limits above 55

Flashes Orange LEDs when in Construction Zone

(Currently signal is not working properly)

Display Left and Right Turn Signals on Bar Graph

I am also interfacing to the canserver with Teslax

Josh has done an amazing job with this product but as always, I have a wish list for future products

Larger TFT display that is fully programmable as messages or graphics
CAN message link to and audio player for internal and external messages. Would be nice for us older non boom box folks. Text to speech would be great to add real time info such as construction zone, school zone, tire pressure, range etc. Also, some fun sentry mode comments would be great.
Adjustable screen brightness
Trending and some basic machine learning functions such as predicting when you should add air in the tires. Difference in inflation between the tires, and lost efficiency per PSI difference from optimum.
It would be nice if Elon would add a power user or hobbiest screen on the display with user configurable buttons and sliders. Very easy to add and would make for some great interface options.



C++:


-- Turn displays off if car center display is off

if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then

for i = 0,1

do

CANServer_setDisplayString(i, "1m t0b1000r")

end

return

end

-- If Vehicle Speed is = 0 Mph (stopped) then display Stoplight Mode

local displaysd = CANServer_getAnalysisVar("VehSpeed")

displaysd = math.floor(displaysd * 0.6213712)

if (displaysd == 0) then

-- Stoplight Mode

-- If Speed is less 0 Mph (stopped) aleternate between these displays

-- Display switch time is set at 5 seconds

local currentMills = CANServer_millis()

local lastSwitchTime = CANServer_getVar('lastSwitchTime')

local displayNumber = CANServer_getVar('displayNumber')

if (currentMills - lastSwitchTime > 5000) then

displayNumber = displayNumber + 1

if (displayNumber > 4) then

displayNumber = 0

end

CANServer_setVar('displayNumber', displayNumber)

CANServer_setVar('lastSwitchTime', currentMills)

end

if (displayNumber == 0) then

local hrs = CANServer_getAnalysisVar("Hours")

local min = CANServer_getAnalysisVar("Minutes")

-- converts UTC to Eastern Standard Time 12 Hr format

-- 24 - 5 for EST

hrs = hrs + 19;

local zone = "AM";

if (hrs > 24) and (hrs < 37) then

hrs = hrs - 12;

zone = "AM";

else if (hrs < 25) then

hrs = hrs - 24;

zone = "PM";

else if (hrs > 36) then

hrs = hrs - 36;

zone = "PM";

end

end

end

-- Display Time and Temperature

CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -TIME- " .. " " .. math.floor(hrs) .. ":" .. math.floor(min) .. zone .."t" .. "b1m1o100r")

else if (displayNumber == 1) then

-- Display Front Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontLeft") * 14.5038)) * 10) .. "vTNORFu" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontRight") * 14.5038)) * 10) .. "vTNORFu" .. "b0m1o100r");

else if (displayNumber == 2) then

-- Display Rear Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearLeft") * 14.5038)) * 10) .. "vRAER u" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearRight") * 14.5038)) * 10) .. "vRAER u" .. "b0m1o100r");

else if (displayNumber == 3) then

-- Displays Temperature and Mile Range

CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -RANGE- ".. CANServer_getAnalysisVar("Range") .. "MI " .. "t" .. "b1m1o100r");

end

end

end

end

end

local displayspd = CANServer_getAnalysisVar("VehSpeed")

displayspd = math.floor(displaysd * 0.6213712)

if (displayspd > 5) then

-- Speed Limit Script

-- Left and Right Blindspot Arrow Overlay

-- Sets Left Blindspot Arrow Overlay Variable

local bsl = CANServer_getAnalysisVar("BSL");

local bld = 0;

local r0time = 100;

-- Sets Right Blindspot Arrow Overlay Variable

local bsr = CANServer_getAnalysisVar("BSR");

local brd = 0;

local r1time = 100;

-- Value of 1 will Display Left Arrow Ovlerlay

if (bsl == l or bsl == 2) then

bld = 1;

r0time = 800;

end

-- Value of 2 will Display Right Arrow Ovlerlay

if (bsr == l or bsr == 2) then

brd = 2;

r1time = 800;

end

-- If bld value > 0 display the Left Blindspot overlay on Display 0

if (bld > 0) then

CANServer_setDisplayString(0, bld .. "v63488c6m1000r")

end

-- If brd value > 0 display the Right Blindspot overlay on Display 1

if (brd > 0) then

CANServer_setDisplayString(1, brd .. "v63488c6m1000r")

end

-- Calculates vehicle speed in Miles per Hour

local displayspeed = CANServer_getAnalysisVar("VehSpeed")

displayspeed = displayspeed * 0.6213712

-- Calculates difference between Vehicle Speed and Speed Limit for Display 1

local spl = CANServer_getAnalysisVar("SPL")

local dif = (displayspeed - spl)

local disp0bar = 0;

local disp1bar = 0

-- Displays One Red LED per 5 MPH above speed limit

if (dif > 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Displays One Green LED per 5 MPH below speed limit

if (dif < 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit

-- Threshold changes from 15 to 20 Mph at speed limits above 55

if ((spl < 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

if ((spl > 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

-- Flashes Orange LEDs when in Construction Zone

local cnz = CANServer_getAnalysisVar("ConstZone")

if (cnz > 1) then

disp0bar = 40;

end

-- Display Turn Signals on Bar Graph

-- Left turn signal on bargraph 14 green LEDs

if (CANServer_getAnalysisVar("VCFRONT_indicatorLef") == 2) then -- Lef blinker on bargraph

disp0bar = -14;

end

-- Right turn signal on bargraph 14 green LEDs

if (CANServer_getAnalysisVar("VCFRONT_indicatorRig") == 2) then -- right blinker on bargraph

disp1bar = -14;

end

-- Sets Displays

local displaySped = CANServer_getAnalysisVar("VehSpeed")

displaySped = displaySped * 0.6213712

CANServer_setDisplayString(0, "65535c" .. math.floor(displaySped * 10) .. "vHPM u" .. disp0bar .. "b" .. r0time .. "r0m0o")

CANServer_setDisplayString(1, "65535c" .. math.floor(dif * 10) .. "vHPM u" .. disp1bar .. "b" .. r1time .. "r0m1o")

end

-- If Vehicle Speed is below 5 Mph display Parking Mode

local displaySpeed = CANServer_getAnalysisVar("VehSpeed")

displaySpeed = displaySpeed * 0.6213712

if ((displaySpeed > 0 and displaySpeed < 5) or (displaySpeed < 0)) then

-- Parking Sensor Script

-- When in Drive displays display front parking sensors and when in reverse display rear sensors

local disp0bar = 0;

local disp1bar = 0;

local dgs = 0;

-- Front Sensor Variables

-- Converted from CM to inches

local dgs = CANServer_getAnalysisVar("DriveGearStat");

local fls = CANServer_getAnalysisVar("ParkFrontLeft");

fls = fls * 0.39370;

local flm = CANServer_getAnalysisVar("ParkFrontLeftMid");

flm = flm * 0.39370;

local frm = CANServer_getAnalysisVar("ParkFrontRightMid");

frm = frm * 0.39370;

local frs = CANServer_getAnalysisVar("ParkFrontRight")

frs = frs * 0.39370;

-- Rear Sensor Variables

-- Converted from CM to inches

local rls = CANServer_getAnalysisVar("ParkRearLeft");

rls = rls * 0.39370;

local rlm = CANServer_getAnalysisVar("ParkRearLeftMid");

rlm = rlm * 0.39370;

local rrm = CANServer_getAnalysisVar("ParkRearRightMid");

rrm = rrm * 0.39370;

local rrs = CANServer_getAnalysisVar("ParkRearRight")

rrs = rrs * 0.39370;

-- If Vehicle is in Drive display Front Sensors

if (dgs == 4) then

-- Display Left and Right Sensors on Bar Graph in Red, each LED is 2 Inches

disp0bar = fls / (-2);

disp1bar = frs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(flm * 10) .. "vTNORFu" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(frm * 10) .. "vTNORFu" .. disp1bar .. "b100r0m1o");

end

-- If Vehicle is in Reverse display Rear Sensors

if (dgs == 2) then

disp0bar = rls / (-2);

disp1bar = rrs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(rlm * 10) .. "vRAER u" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(rrs * 10) .. "vRAER u" .. disp1bar .. "b100r0m1o");

end

end

return

{

"n": "ConstZone",

"bid": "1",

"fid": 583,

"sb": 24,

"bl": 1,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Hours",

"bid": "-1",

"fid": 792,

"sb": 24,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Minutes",

"bid": "-1",

"fid": 792,

"sb": 40,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "OutsideTemp",

"bid": "-1",

"fid": 801,

"sb": 40,

"bl": 8,

"f": 0.5,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontLeft",

"bid": "1",

"fid": 526,

"sb": 18,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontLeftMid",

"bid": "1",

"fid": 526,

"sb": 27,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontLeftRaw",

"bid": "1",

"fid": 526,

"sb": 9,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 0,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Range",

"bid": "-1",

"fid": 826,

"sb": 0,

"bl": 10,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "SPL",

"bid": "1",

"fid": 921,

"sb": 8,

"bl": 5,

"f": 5,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Seconds",

"bid": "-1",

"fid": 792,

"sb": 16,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontLeft",

"bid": "-1",

"fid": 799,

"sb": 0,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontRight",

"bid": "-1",

"fid": 799,

"sb": 16,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearLeft",

"bid": "-1",

"fid": 799,

"sb": 32,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearRight",

"bid": "-1",

"fid": 799,

"sb": 48,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "VehSpeed",

"bid": "-1",

"fid": 599,

"sb": 12,

"bl": 12,

"f": 0.08,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

Mod edit: inserted code into code block for legibility


----------



## JWardell

Madmolecule said:


> *Dual Display Script Functionality*
> I have tried to create a script to add additional information for a dual display set-up. I find it really provides a lot of additional information that provides more situational awareness. I have just used it for a couple of days so I would certainly like your feedback on functionality as well as how to program the same functionality more elegantly as I am not much of a programmer.
> 
> *Features:
> Display Mode*
> 
> Turn displays off if car center display is off
> If Vehicle Speed is = 0 Mph (stopped), display *Stoplight Mode*
> If Vehicle Speed is below 5 Mph and not 0 Mph (stopped), display *Parking Mode*
> If Vehicle Speed is above 5 Mph display, *Speed Limit Mode*
> *Modes
> 
> Stoplight Mode*
> If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
> Alternate between four, 4, different displays while the vehicle is stopped. Displays alternate every 5 seconds.
> Also disables turn signal indicator when stopped
> 
> *Display 1*
> Time and Temperature
> UTC Time converted to EST
> 
> View attachment 36937
> 
> 
> *Display 2*
> Front Left and Right Tire Pressure (PSI)
> 
> View attachment 36936
> 
> 
> *Display 3*
> Rear Left and Right Tire Pressure (PSI)
> 
> View attachment 36935
> 
> 
> *Display 4*
> Time and Range (Miles)
> 
> View attachment 36938
> 
> 
> *Parking Mode*
> When Vehicle is in Drive display Front Sensors
> When Vehicle is in Reverse display Rear Sensors
> View attachment 36943
> 
> 
> Display Front Middle Left and Front Middle Right sensors on the digital display
> Display Left and Right-Side Sensors on Bar Graph in Red, each LED is 2 Inches
> 
> *Speed Limit Mode*
> 
> If Vehicle Speed is above 5 Mph display, Speed Limit Mode
> 
> Displays Speed and Speed Limit
> 
> Displays Left and Right Blindspot Arrow Overlays
> 
> View attachment 36941
> 
> Displays on the bar graph One Red LED per 5 MPH above speed limit
> 
> Displays on the bar graph One Green LED per 5 MPH below speed limit
> 
> Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit
> View attachment 36942
> 
> Threshold changes from 15 to 20 Mph at Speed Limits above 55
> 
> Flashes Orange LEDs when in Construction Zone
> 
> (Currently signal is not working properly)
> 
> Display Left and Right Turn Signals on Bar Graph
> 
> I am also interfacing to the canserver with Teslax
> 
> Josh has done an amazing job with this product but as always, I have a wish list for future products
> 
> Larger TFT display that is fully programmable as messages or graphics
> CAN message link to and audio player for internal and external messages. Would be nice for us older non boom box folks. Text to speech would be great to add real time info such as construction zone, school zone, tire pressure, range etc. Also, some fun sentry mode comments would be great.
> Adjustable screen brightness
> Trending and some basic machine learning functions such as predicting when you should add air in the tires. Difference in inflation between the tires, and lost efficiency per PSI difference from optimum.
> It would be nice if Elon would add a power user or hobbiest screen on the display with user configurable buttons and sliders. Very easy to add and would make for some great interface options.
> 
> 
> 
> C++:
> 
> 
> -- Turn displays off if car center display is off
> 
> if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then
> 
> for i = 0,1
> 
> do
> 
> CANServer_setDisplayString(i, "1m t0b1000r")
> 
> end
> 
> return
> 
> end
> 
> -- If Vehicle Speed is = 0 Mph (stopped) then display Stoplight Mode
> 
> local displaysd = CANServer_getAnalysisVar("VehSpeed")
> 
> displaysd = math.floor(displaysd * 0.6213712)
> 
> if (displaysd == 0) then
> 
> -- Stoplight Mode
> 
> -- If Speed is less 0 Mph (stopped) aleternate between these displays
> 
> -- Display switch time is set at 5 seconds
> 
> local currentMills = CANServer_millis()
> 
> local lastSwitchTime = CANServer_getVar('lastSwitchTime')
> 
> local displayNumber = CANServer_getVar('displayNumber')
> 
> if (currentMills - lastSwitchTime > 5000) then
> 
> displayNumber = displayNumber + 1
> 
> if (displayNumber > 4) then
> 
> displayNumber = 0
> 
> end
> 
> CANServer_setVar('displayNumber', displayNumber)
> 
> CANServer_setVar('lastSwitchTime', currentMills)
> 
> end
> 
> if (displayNumber == 0) then
> 
> local hrs = CANServer_getAnalysisVar("Hours")
> 
> local min = CANServer_getAnalysisVar("Minutes")
> 
> -- converts UTC to Eastern Standard Time 12 Hr format
> 
> -- 24 - 5 for EST
> 
> hrs = hrs + 19;
> 
> local zone = "AM";
> 
> if (hrs > 24) and (hrs < 37) then
> 
> hrs = hrs - 12;
> 
> zone = "AM";
> 
> else if (hrs < 25) then
> 
> hrs = hrs - 24;
> 
> zone = "PM";
> 
> else if (hrs > 36) then
> 
> hrs = hrs - 36;
> 
> zone = "PM";
> 
> end
> 
> end
> 
> end
> 
> -- Display Time and Temperature
> 
> CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")
> 
> CANServer_setDisplayString(1, "65535c2s -TIME- " .. " " .. math.floor(hrs) .. ":" .. math.floor(min) .. zone .."t" .. "b1m1o100r")
> 
> else if (displayNumber == 1) then
> 
> -- Display Front Tire Pressure
> 
> -- Get Tire Pressures and convert fro Bar to PSI
> 
> CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontLeft") * 14.5038)) * 10) .. "vTNORFu" .. "b0m0o100r");
> 
> CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontRight") * 14.5038)) * 10) .. "vTNORFu" .. "b0m1o100r");
> 
> else if (displayNumber == 2) then
> 
> -- Display Rear Tire Pressure
> 
> -- Get Tire Pressures and convert fro Bar to PSI
> 
> CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearLeft") * 14.5038)) * 10) .. "vRAER u" .. "b0m0o100r");
> 
> CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearRight") * 14.5038)) * 10) .. "vRAER u" .. "b0m1o100r");
> 
> else if (displayNumber == 3) then
> 
> -- Displays Temperature and Mile Range
> 
> CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")
> 
> CANServer_setDisplayString(1, "65535c2s -RANGE- ".. CANServer_getAnalysisVar("Range") .. "MI " .. "t" .. "b1m1o100r");
> 
> end
> 
> end
> 
> end
> 
> end
> 
> end
> 
> local displayspd = CANServer_getAnalysisVar("VehSpeed")
> 
> displayspd = math.floor(displaysd * 0.6213712)
> 
> if (displayspd > 5) then
> 
> -- Speed Limit Script
> 
> -- Left and Right Blindspot Arrow Overlay
> 
> -- Sets Left Blindspot Arrow Overlay Variable
> 
> local bsl = CANServer_getAnalysisVar("BSL");
> 
> local bld = 0;
> 
> local r0time = 100;
> 
> -- Sets Right Blindspot Arrow Overlay Variable
> 
> local bsr = CANServer_getAnalysisVar("BSR");
> 
> local brd = 0;
> 
> local r1time = 100;
> 
> -- Value of 1 will Display Left Arrow Ovlerlay
> 
> if (bsl == l or bsl == 2) then
> 
> bld = 1;
> 
> r0time = 800;
> 
> end
> 
> -- Value of 2 will Display Right Arrow Ovlerlay
> 
> if (bsr == l or bsr == 2) then
> 
> brd = 2;
> 
> r1time = 800;
> 
> end
> 
> -- If bld value > 0 display the Left Blindspot overlay on Display 0
> 
> if (bld > 0) then
> 
> CANServer_setDisplayString(0, bld .. "v63488c6m1000r")
> 
> end
> 
> -- If brd value > 0 display the Right Blindspot overlay on Display 1
> 
> if (brd > 0) then
> 
> CANServer_setDisplayString(1, brd .. "v63488c6m1000r")
> 
> end
> 
> -- Calculates vehicle speed in Miles per Hour
> 
> local displayspeed = CANServer_getAnalysisVar("VehSpeed")
> 
> displayspeed = displayspeed * 0.6213712
> 
> -- Calculates difference between Vehicle Speed and Speed Limit for Display 1
> 
> local spl = CANServer_getAnalysisVar("SPL")
> 
> local dif = (displayspeed - spl)
> 
> local disp0bar = 0;
> 
> local disp1bar = 0
> 
> -- Displays One Red LED per 5 MPH above speed limit
> 
> if (dif > 0) then
> 
> disp0bar = (dif / 5);
> 
> disp1bar = (dif / 5);
> 
> end
> 
> -- Displays One Green LED per 5 MPH below speed limit
> 
> if (dif < 0) then
> 
> disp0bar = (dif / 5);
> 
> disp1bar = (dif / 5);
> 
> end
> 
> -- Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit
> 
> -- Threshold changes from 15 to 20 Mph at speed limits above 55
> 
> if ((spl < 55) and(dif > 15)) then
> 
> disp0bar = 18;
> 
> disp1bar = 18;
> 
> end
> 
> if ((spl > 55) and(dif > 15)) then
> 
> disp0bar = 18;
> 
> disp1bar = 18;
> 
> end
> 
> -- Flashes Orange LEDs when in Construction Zone
> 
> local cnz = CANServer_getAnalysisVar("ConstZone")
> 
> if (cnz > 1) then
> 
> disp0bar = 40;
> 
> end
> 
> -- Display Turn Signals on Bar Graph
> 
> -- Left turn signal on bargraph 14 green LEDs
> 
> if (CANServer_getAnalysisVar("VCFRONT_indicatorLef") == 2) then -- Lef blinker on bargraph
> 
> disp0bar = -14;
> 
> end
> 
> -- Right turn signal on bargraph 14 green LEDs
> 
> if (CANServer_getAnalysisVar("VCFRONT_indicatorRig") == 2) then -- right blinker on bargraph
> 
> disp1bar = -14;
> 
> end
> 
> -- Sets Displays
> 
> local displaySped = CANServer_getAnalysisVar("VehSpeed")
> 
> displaySped = displaySped * 0.6213712
> 
> CANServer_setDisplayString(0, "65535c" .. math.floor(displaySped * 10) .. "vHPM u" .. disp0bar .. "b" .. r0time .. "r0m0o")
> 
> CANServer_setDisplayString(1, "65535c" .. math.floor(dif * 10) .. "vHPM u" .. disp1bar .. "b" .. r1time .. "r0m1o")
> 
> end
> 
> -- If Vehicle Speed is below 5 Mph display Parking Mode
> 
> local displaySpeed = CANServer_getAnalysisVar("VehSpeed")
> 
> displaySpeed = displaySpeed * 0.6213712
> 
> if ((displaySpeed > 0 and displaySpeed < 5) or (displaySpeed < 0)) then
> 
> -- Parking Sensor Script
> 
> -- When in Drive displays display front parking sensors and when in reverse display rear sensors
> 
> local disp0bar = 0;
> 
> local disp1bar = 0;
> 
> local dgs = 0;
> 
> -- Front Sensor Variables
> 
> -- Converted from CM to inches
> 
> local dgs = CANServer_getAnalysisVar("DriveGearStat");
> 
> local fls = CANServer_getAnalysisVar("ParkFrontLeft");
> 
> fls = fls * 0.39370;
> 
> local flm = CANServer_getAnalysisVar("ParkFrontLeftMid");
> 
> flm = flm * 0.39370;
> 
> local frm = CANServer_getAnalysisVar("ParkFrontRightMid");
> 
> frm = frm * 0.39370;
> 
> local frs = CANServer_getAnalysisVar("ParkFrontRight")
> 
> frs = frs * 0.39370;
> 
> -- Rear Sensor Variables
> 
> -- Converted from CM to inches
> 
> local rls = CANServer_getAnalysisVar("ParkRearLeft");
> 
> rls = rls * 0.39370;
> 
> local rlm = CANServer_getAnalysisVar("ParkRearLeftMid");
> 
> rlm = rlm * 0.39370;
> 
> local rrm = CANServer_getAnalysisVar("ParkRearRightMid");
> 
> rrm = rrm * 0.39370;
> 
> local rrs = CANServer_getAnalysisVar("ParkRearRight")
> 
> rrs = rrs * 0.39370;
> 
> -- If Vehicle is in Drive display Front Sensors
> 
> if (dgs == 4) then
> 
> -- Display Left and Right Sensors on Bar Graph in Red, each LED is 2 Inches
> 
> disp0bar = fls / (-2);
> 
> disp1bar = frs / (-2);
> 
> CANServer_setDisplayString(0, "65535c" .. math.floor(flm * 10) .. "vTNORFu" .. disp0bar .. "b100r0m0o");
> 
> CANServer_setDisplayString(1, "65535c" .. math.floor(frm * 10) .. "vTNORFu" .. disp1bar .. "b100r0m1o");
> 
> end
> 
> -- If Vehicle is in Reverse display Rear Sensors
> 
> if (dgs == 2) then
> 
> disp0bar = rls / (-2);
> 
> disp1bar = rrs / (-2);
> 
> CANServer_setDisplayString(0, "65535c" .. math.floor(rlm * 10) .. "vRAER u" .. disp0bar .. "b100r0m0o");
> 
> CANServer_setDisplayString(1, "65535c" .. math.floor(rrs * 10) .. "vRAER u" .. disp1bar .. "b100r0m1o");
> 
> end
> 
> end
> 
> return
> 
> {
> 
> "n": "ConstZone",
> 
> "bid": "1",
> 
> "fid": 583,
> 
> "sb": 24,
> 
> "bl": 1,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "Hours",
> 
> "bid": "-1",
> 
> "fid": 792,
> 
> "sb": 24,
> 
> "bl": 8,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "Minutes",
> 
> "bid": "-1",
> 
> "fid": 792,
> 
> "sb": 40,
> 
> "bl": 8,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "OutsideTemp",
> 
> "bid": "-1",
> 
> "fid": 801,
> 
> "sb": 40,
> 
> "bl": 8,
> 
> "f": 0.5,
> 
> "so": -40,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontLeft",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 18,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontLeftMid",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 27,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontLeftRaw",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 9,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontRight",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 45,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontRightMid",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 36,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkFrontRightRaw",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 0,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkRearRight",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 45,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkRearRightMid",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 36,
> 
> "bl": 0,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "ParkRearRightRaw",
> 
> "bid": "1",
> 
> "fid": 526,
> 
> "sb": 0,
> 
> "bl": 9,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "Range",
> 
> "bid": "-1",
> 
> "fid": 826,
> 
> "sb": 0,
> 
> "bl": 10,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "SPL",
> 
> "bid": "1",
> 
> "fid": 921,
> 
> "sb": 8,
> 
> "bl": 5,
> 
> "f": 5,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "Seconds",
> 
> "bid": "-1",
> 
> "fid": 792,
> 
> "sb": 16,
> 
> "bl": 8,
> 
> "f": 1,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "TPMSFrontLeft",
> 
> "bid": "-1",
> 
> "fid": 799,
> 
> "sb": 0,
> 
> "bl": 8,
> 
> "f": 0.025,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "TPMSFrontRight",
> 
> "bid": "-1",
> 
> "fid": 799,
> 
> "sb": 16,
> 
> "bl": 8,
> 
> "f": 0.025,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "TPMSRearLeft",
> 
> "bid": "-1",
> 
> "fid": 799,
> 
> "sb": 32,
> 
> "bl": 8,
> 
> "f": 0.025,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "TPMSRearRight",
> 
> "bid": "-1",
> 
> "fid": 799,
> 
> "sb": 48,
> 
> "bl": 8,
> 
> "f": 0.025,
> 
> "so": 0,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> {
> 
> "n": "VehSpeed",
> 
> "bid": "-1",
> 
> "fid": 599,
> 
> "sb": 12,
> 
> "bl": 12,
> 
> "f": 0.08,
> 
> "so": -40,
> 
> "s": false,
> 
> "bo": true,
> 
> "log": false,
> 
> "v": 3
> 
> }
> 
> Mod edit: inserted code into code block for legibility


So impressive! I know you put a lot of time and effort into this and have achieved far more than everyone else!
Can you make a walkthrough video demonstrating every screen?


----------



## TrevP

Should have a variable at the start of the code to set metric / imperial. 
That way a non programmer can just select his preference and upload the code


----------



## Madmolecule

That’ll be an easy thing to add. I tried the metric system, it’s just too exact for me, there’s no flavor or color. I prefer a system where a AAA battery is smaller than AA, but a DD bra is larger than a D. You just can’t do that in the metric system.


----------



## TrevP

We use decimal points for the in between


----------



## JWardell

TrevP said:


> Should have a variable at the start of the code to set metric / imperial.
> That way a non programmer can just select his preference and upload the code


At least for the speed limit display code, it will automatically display MPH or KPH as you have it set in the car. More than half of customers use non-freedom units


----------



## Madmolecule

I am updating it to switch everything based on what you choose in the miles/kilometers selection. You will also be able to enter your time zone.


----------



## Long Ranger

Madmolecule said:


> I am updating it to switch everything based on what you choose in the miles/kilometers selection. You will also be able to enter your time zone.


You'd think that would be sufficient, but I believe the UK uses miles for distance/speed but metric units for just about everything else (gotta keep the pint, of course!).


----------



## TrevP

Don’t forget stones!


----------



## Madmolecule

Furlongs per Fortnight?


----------



## JWardell

Smoots per second around here.


----------



## pyjamasam

Come on @TrevP its Maple Syrup per Moose!

chris.


----------



## Eugenius

Madmolecule said:


> C++:
> 
> 
> local hrs = CANServer_getAnalysisVar("Hours")
> 
> local min = CANServer_getAnalysisVar("Minutes")
> 
> -- converts UTC to Eastern Standard Time 12 Hr format
> 
> -- 24 - 5 for EST


Looks very nice, but with hardcoded timezone... (conversion from UTC).

Is there no signal for time zone?


----------



## Madmolecule

I am modifying it and should upload it today with time zone and units selection as well as some other customization timing variables. I am just playing around with this myself. It is Josh's great product. Thats why I hard coded it and removed some of the options Josh built in to begin with.


----------



## JWardell

Eugenius said:


> Looks very nice, but with hardcoded timezone... (conversion from UTC).
> 
> Is there no signal for time zone?


Not that I know of. That's probably just done on the computer using the map/gps location


----------



## Madmolecule

I have updated the script for metric/imperial units



C++:


{
    "n": "DistanceUnitMiles",
    "bid": "-1",
    "fid": 659,
    "sb": 13,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ConstZone",
    "bid": "-1",
    "fid": 583,
    "sb": 24,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "DisplayOn",
    "bid": "-1",
    "fid": 851,
    "sb": 5,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "DistanceUnitMiles",
    "bid": "-1",
    "fid": 659,
    "sb": 13,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "DriveGearStat",
    "bid": "-1",
    "fid": 280,
    "sb": 21,
    "bl": 3,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "Hours",
    "bid": "-1",
    "fid": 792,
    "sb": 24,
    "bl": 8,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "Minutes",
    "bid": "-1",
    "fid": 792,
    "sb": 40,
    "bl": 8,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "OutsideTemp",
    "bid": "-1",
    "fid": 801,
    "sb": 40,
    "bl": 8,
    "f": 0.5,
    "so": -40,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontLeft",
    "bid": "1",
    "fid": 526,
    "sb": 18,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontLeftMid",
    "bid": "1",
    "fid": 526,
    "sb": 27,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontLeftMid",
    "bid": "1",
    "fid": 526,
    "sb": 27,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontLeftRaw",
    "bid": "1",
    "fid": 526,
    "sb": 9,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontRightMid",
    "bid": "1",
    "fid": 526,
    "sb": 36,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkFrontRightRaw",
    "bid": "1",
    "fid": 526,
    "sb": 0,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkRearLeft",
    "bid": "1",
    "fid": 558,
    "sb": 18,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkRearLeftMid",
    "bid": "1",
    "fid": 558,
    "sb": 27,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkRearRight",
    "bid": "1",
    "fid": 558,
    "sb": 45,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkRearRightMid",
    "bid": "1",
    "fid": 558,
    "sb": 36,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "ParkRearRightRaw",
    "bid": "1",
    "fid": 558,
    "sb": 0,
    "bl": 9,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "Range",
    "bid": "-1",
    "fid": 826,
    "sb": 0,
    "bl": 10,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "SPL",
    "bid": "1",
    "fid": 921,
    "sb": 8,
    "bl": 5,
    "f": 5,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "Seconds",
    "bid": "-1",
    "fid": 792,
    "sb": 16,
    "bl": 8,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "TPMSFrontLeft",
    "bid": "-1",
    "fid": 799,
    "sb": 0,
    "bl": 8,
    "f": 0.025,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "TPMSFrontRight",
    "bid": "-1",
    "fid": 799,
    "sb": 16,
    "bl": 8,
    "f": 0.025,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "TPMSRearLeft",
    "bid": "-1",
    "fid": 799,
    "sb": 32,
    "bl": 8,
    "f": 0.025,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "TPMSRearRight",
    "bid": "-1",
    "fid": 799,
    "sb": 48,
    "bl": 8,
    "f": 0.025,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "VCFRONT_indicatorLef",
    "bid": "-1",
    "fid": 1013,
    "sb": 0,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "VCFRONT_indicatorRig",
    "bid": "-1",
    "fid": 1013,
    "sb": 2,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}
{
    "n": "VehSpeed",
    "bid": "-1",
    "fid": 599,
    "sb": 12,
    "bl": 12,
    "f": 0.08,
    "so": -40,
    "s": false,
    "bo": true,
    "log": false,
    "v": 3
}




C++:


-- Set for your local time zone, Time offset is 5 for EST and 6 for CST
    local timeoffset = 5;
-- Set Setpoint for Speed Limit Display to display,in MPH or KPH
    local speedlimitdisp = 5;
-- Set Redlight mode Screen rotation time
    local screenswap = 3000;
-- Set Over Speed Limit Threshold, if Speed Limit is less than speedlimit1
    local speedthresh1 = 15;
    local speedlimit1 = 55;
-- Set Over Speed Limit Threshold, if Speed Limit is greater than speedlimit1
    local speedthresh2 = 20;
    local speedlimit2 = 54;
-- LEDs to display when turn signal is on
    local turnsigleds = -14;
-- Speed at which to change modes
    local speedthresh3 = 5;
    local speedthresh4 = 5;

-- Conversion Multipliers
    local tempmult = 1.8;
    local tempadd = 32;
    local speedmult = 0.6213712;
    local speedlmult = 1;
    local distmult = 0.393701;
    local dist2mult = 1;
    local pressmult = 14.5038;
    local hour1 = 24;
    local hour2 = 37;
    local hour3 = 24;
    local hour4 = 36;
    local zone2 = zone
-- Conversion Units
    local tempunits    = "F    ";
    local pressunit = "ISP";
    local rangeunits = "MI ";
    local speedunits = "HPM  ";
    local distunits = "NI  ";
    local timespace = " "

local displayspeed = CANServer_getAnalysisVar("VehSpeed");
local speedlimit = CANServer_getAnalysisVar("SPL");
displayspeed = displayspeed * speedmult

local disp0bar = 0;;
local disp1bar = 0;

if (CANServer_getAnalysisVar("DistanceUnitMiles") == 0) then -- convert to Metric

speedmult = 1;
speedunits = "HPK ";
pressmult = 1;
tempmult = 1;
tempadd = 0;
tempunits = "C    ";
rangeunits = "KM  ";
pressunit = "RAB"
dist2mult = 1.60934
speedlmult = 1.60934
distunits = "MC  ";
hour1 = 24;
hour2 = 48;
hour3 = 18;
hour4 = 48;
timespace = "  ";
zone2 = " ";
end

-- Turn displays off if car center display is off
if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then
    for i = 0,1
    do
        CANServer_setDisplayString(i, "1m                  t0b1000r")
    end
    return
end

-- If Vehicle Speed is = 0 Mph (stopped) then display Stoplight Mode

if (displayspeed == 0) then

--  Stoplight Mode
--  If Speed is less 0 Mph (stopped) aleternate between these displays
--  Display switch time is set at 5 seconds

    local currentMills = CANServer_millis()
    local lastSwitchTime = CANServer_getVar('lastSwitchTime')
    local displayNumber = CANServer_getVar('displayNumber')

if (currentMills - lastSwitchTime > screenswap) then
      displayNumber = displayNumber + 1

  if (displayNumber > 4) then
        displayNumber = 0
end
  CANServer_setVar('displayNumber', displayNumber)
  CANServer_setVar('lastSwitchTime', currentMills)
end

if (displayNumber == 0) then

local hrs = CANServer_getAnalysisVar("Hours")
local min = CANServer_getAnalysisVar("Minutes")

-- converts UTC to Eastern Standard Time 12 Hr format
-- 24 - 5 for EST

hrs = hrs + (24- timeoffset);
    if (hrs > hour1) and (hrs < hour2)  then
        hrs = hrs - 24;
        zone = "AM";
    else if (hrs < hour3) then
        hrs = hrs - 12;
        zone = "PM";
    else if (hrs > hour4) then
        hrs = hrs - 36;
        zone2 = "PM";

end
end
end

-- Display Time and Temperature
CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (tempmult)) + tempadd) * 10) .. "v" .. tempunits .. "u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s  -TIME- ".. timespace .. math.floor(hrs) .. ":" .. math.floor(min) .. zone2 .."tb1m1o100r")

else if (displayNumber == 1) then

-- Display Front Tire Pressure
-- Get Tire Pressures and convert fro Bar to PS
CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontLeft") * pressmult)) * 10) .. "v" .. pressunit .. " Fu" .. "b0m0o100r");
CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontRight") * pressmult)) * 10) .. "v" .. pressunit .. " Fu" .. "b0m1o100r");

else if (displayNumber == 2) then

-- Display Rear Tire Pressure
-- Get Tire Pressures and convert fro Bar to PSI
CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearLeft") * pressmult)) * 10) .. "v" .. pressunit .. " Ru" .. "b0m0o100r");
CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearRight") * pressmult)) * 10) .. "v" .. pressunit .. " Ru" .. "b0m1o100r");

else if (displayNumber == 3) then

-- Displays Temperature and Mile Range

CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (tempmult)) + tempadd) * 10) .. "v" .. tempunits .. "u".. "100r0m0o")
CANServer_setDisplayString(1, "65535c2s -RANGE- ".. " " .. math.floor(CANServer_getAnalysisVar("Range") * dist2mult) .. rangeunits .. "t" .. "b1m1o100r");
end
end
end
end
end

if (displayspeed > speedthresh3) then

-- Speed Limit Script

-- Left and Right Blindspot Arrow Overlay
    -- Sets Left Blindspot Arrow Overlay Variable
        local bsl = CANServer_getAnalysisVar("BSL");
        local bld = 0;
        local r0time = 100;
    -- Sets Right Blindspot Arrow Overlay Variable      
        local bsr = CANServer_getAnalysisVar("BSR");
        local brd = 0;
        local r1time = 100;

-- Value of 1 will Display Left Arrow Ovlerlay
    if (bsl == l or bsl == 2) then
           bld = 1;
            r0time = 800;
    end
-- Value of 2 will Display Right Arrow Ovlerlay
        if (bsr == l or bsr == 2) then
            brd = 2;
           r1time = 800;
    end
-- If bld value > 0 display the Left Blindspot overlay on Display 0
    if (bld > 0) then
        CANServer_setDisplayString(0, bld .. "v63488c6m1000r")
    end
-- If brd value > 0 display the Right Blindspot overlay on Display 1
    if (brd > 0) then
        CANServer_setDisplayString(1, brd .. "v63488c6m1000r")
    end

--  Calculates vehicle speed in Miles per Hour
        local displayspeed = CANServer_getAnalysisVar("VehSpeed")
        displayspeed = displayspeed *speedmult
--  Calculates difference between Vehicle Speed and Speed Limit for Display 1
        local speedlimit = math.floor(CANServer_getAnalysisVar("SPL") * speedlmult)
        local dif = (displayspeed - speedlimit)
        local disp0bar = 0;
        local disp1bar = 0

--  Displays One Red LED per 5 MPH/KPH above speed limit
    if (dif > 0) then
        disp0bar = (dif / 5);
        disp1bar = (dif / 5);
    end
--  Displays One Green LED per 5 MPH/KPH below speed limit
    if (dif < 0) then
        disp0bar = (dif / 5);
        disp1bar = (dif / 5);
    end
--  Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit
--  Threshold changes from 15 to 20 Mph at speed limits above 55
    if (speedlimit < speedlimit1) and (dif > speedthresh1) then
        disp0bar = 18;
        disp1bar = 18;
    end
    if (speedlimit > speedlimit2) and (dif > speedthresh2) then
        disp0bar = 18;
        disp1bar = 18;
    end
--  Flashes Orange LEDs when in Construction Zone
        local cnz = CANServer_getAnalysisVar("ConstZone")
    if (cnz > 1) then
        disp0bar = 40;
        disp1bar = 40;
    end

-- Display Turn Signals on Bar Graph

-- Left turn signal on bargraph 14 green LEDs

    if (CANServer_getAnalysisVar("VCFRONT_indicatorLef") == 2) then -- Left blinker on bargraph
            disp0bar = turnsigleds;
    end

-- Right turn signal on bargraph 14 green LEDs

if (CANServer_getAnalysisVar("VCFRONT_indicatorRig") == 2) then -- right blinker on bargraph
            disp1bar = turnsigleds;

    end

CANServer_setDisplayString(0, "65535c" .. math.floor(displayspeed * 10) .. "v" .. speedunits .. "u" .. disp0bar .. "b" .. r0time .. "r0m0o")
CANServer_setDisplayString(1, "65535c" .. math.floor(dif * 10) .. "v" .. speedunits ..  "u" .. disp1bar .. "b" .. r1time .. "r0m1o")

end

-- If Vehicle Speed is below displaytresh3 amd not stopped display Parking Mode
if (displayspeed > 0) and (displayspeed < speedthresh4) or  (displayspeed < 0) then
-- Parking Sensor Script
-- When in Drive displays display front parking sensors and when in reverse display rear sensors

-- If Vehicle is in Drive display Front Sensors
    if (CANServer_getAnalysisVar("DriveGearStat") == 4) then
    disp0bar = (CANServer_getAnalysisVar("ParkFrontLeft") * distmult)/ (-2);
    disp1bar = (CANServer_getAnalysisVar("ParkFrontRight")* distmult)/ (-2);
CANServer_setDisplayString(0, "65535c" .. ((CANServer_getAnalysisVar("ParkFrontLeftMid") * distmult) * 10) .. "v" .. distunits .. "F" .. "u" .. disp0bar .. "b100r0m0o");
CANServer_setDisplayString(1, "65535c" .. ((CANServer_getAnalysisVar("ParkFrontRightMid") * distmult)* 10) .. "v" .. distunits .. "F" .. "u" .. disp1bar .. "b100r0m1o");
    end
-- If Vehicle is in Reverse display Rear Sensors
    if (CANServer_getAnalysisVar("DriveGearStat") == 2) then
    disp0bar =(CANServer_getAnalysisVar("ParkRearLeft") * distmult)/ (-2);
    disp1bar = (CANServer_getAnalysisVar("ParkRearRight") * distmult)/ (-2);
CANServer_setDisplayString(0, "65535c" .. ((CANServer_getAnalysisVar("ParkRearLeftMid") * distmult) * 10) .. "v" .. distunits .. "R" .. "u" .. disp0bar .. "b100r0m0o");
CANServer_setDisplayString(1, "65535c" .. ((CANServer_getAnalysisVar("ParkRearRightMid") * distmult)* 10) .. "v" .. distunits .. "R" .. "u" .. disp1bar .. "b100r0m1o");
    end
end

return


----------



## Madmolecule

A quick demo of its functionality


----------



## JWardell

Madmolecule said:


> CanServer Dual display script demo
> 
> A quick demo of its functionality


Wow this is incredible!!


----------



## Madmolecule

To adjust the time for your specific time zone, I created a little spreadsheet to make it easier to determine the variable values for the script


local hour1 =local hour2 =local hour3 =local hour4 =


----------



## Roci

This is a prototype display I made with cheap OLEDs and an ESP8266 board which connects to CANserver. I also added a feature to the server which allows it to listen for movement of the right scroll wheel on the steering wheel, and scroll through different pages of info, inspired by how a Model S has that abililty on the binacle.


----------



## JWardell

More awesome work! I started with those little OLEDs but went with the larger LCD for microdisplay...I still have yet to find an OLED that is just the right size.
I designed the original display to have buttons on the side with the intention of paging through displays like this...but no one ever used or showed interest in them, so I left them out of the new display bargraph. But if you want @Roci the display code and protocol does support them so you could easily add buttons to your displays.


----------



## Roci

Thought I'd share my code which detects the right scroll wheel movement, changes between any number of pages, and shows a title for a few seconds before showing the actual data. Two caveats so far: 1) This works much better with CANserver v2 because of how it polls every 40 ms instead of waiting for the display to request new data, and 2) it does not yet detect the autopilot state, so that means that changing the autopilot speed while it's engaged will also change the screen page. This code could be adapted to work with the microDisplays, but currently it is using the format of my custom screen module which uses a 9 field CSV to send 3 screens worth of data at the same time. Feel free to post any suggestions or modifications of your own!
EDIT 2/23/21: Fixed a glitch in the page detection


Code:


function main()
    local page = CANServer_getVar("page")
    local prevTicks = CANServer_getVar("prevTicks")

    -- set how many pages you want (+1 if you want a blank page)
    local totalPages = 7
   
    -- set how long title screen is shown in milliseconds
    local titleDuration = 2000

    -- get the number of ticks from scroll wheel and use it to change pages
    if (CANServer_getAnalysisVar("SwitchStatusIndex") == 1) then
        ticks = CANServer_getAnalysisVar("RightScrollTicks")
        -- check ticks value against previous value so the action is not duplicated
        -- and ignore the result 21 which is caused when there is a multiplexor timing glitch
        if ((ticks ~= prevTicks) and (ticks ~= 21)) then
            page = page + ticks

            -- loop page number when out of range
            if (page > totalPages) then
                page = 1
            elseif (page < 1) then
                page = totalPages
            end

            CANServer_setVar("page", page)
            CANServer_setVar("prevTicks", ticks)
        end
    end

    -- set page to last page if center touchscreen is off to blank the displays
    if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then
        page = totalPages
    end

    local titleDisplay, oneMode, one, twoMode, two, threeMode, three
    local one_ = ""
    local two_ = ""
    local three_ = ""
    local currentMills = CANServer_millis()
    local lastSwitchTime = CANServer_getVar("lastSwitchTime")
    local prevPage = CANServer_getVar("prevPage")

    -- detect when page changes so we can show titles
    if (prevPage ~= page) then
        CANServer_setVar("lastSwitchTime", currentMills)
        CANServer_setVar("prevPage", page)
    end

    -- detect when titleDuration has elapsed to change from showing titles to data
    if (currentMills - lastSwitchTime > titleDuration) then
        titleDisplay = false
    else
        titleDisplay = true
        oneMode = 32
        twoMode = 32
        threeMode = 32
    end

    -- detect which page we're on and show that data only
    if (page == 1) then
        if titleDisplay then
            one = "AMBIENT"      
            two = "SPEED"
            three = "TIME"
        else
            one = CANServer_getAnalysisVar("OutsideTemp") * 1.8 + 32 .. " F"
            two = math.ceil(CANServer_getAnalysisVar("VehSpeed") * 0.6213712)
            -- formats time to HH:MM AM/PM
            -- time zone is -5 UTC (EST) - to set your time zone, multiply your UTC offset by 3600 and replace the 18000 below
            three = os.date("%I:%M %p", os.time() - 18000)

            oneMode = 31
            twoMode = 32
            threeMode = 31  
        end
    elseif (page == 2) then
        if titleDisplay then
            one = "MAX REGN"
            two = "BATT KW"
            three = "MAX DISC"
        else
            one = -math.floor(CANServer_getAnalysisVar("MaxRegen")) .. "kW"
            two = string.format("%.1f", (CANServer_getAnalysisVar("BattVolts") * CANServer_getAnalysisVar("BattAmps") / 1000.0)) .. "kW"
            three = math.floor(CANServer_getAnalysisVar("MaxDisChg")) .. "kW"

            oneMode = 31
            twoMode = 31
            threeMode = 31  
        end
    elseif (page == 3) then
        if titleDisplay then
            one = "<<<"
            two = "TORQUE"
            three = ">>>"
        else
            local oneA, twoA, threeA
            local oneB, twoB, threeB
            local torque_f, torque_r
           
            torque_f = math.floor(CANServer_getAnalysisVar("FrontTorque"))
            torque_r = math.floor(CANServer_getAnalysisVar("RearTorque"))      

            oneA, twoA, threeA = bargraph(torque_f, 300)
            oneB, twoB, threeB = bargraph(torque_r, 300)
            one = oneA .. "`" .. oneA .. "`" .. oneB .. "`" .. oneB .. "`"
            two = twoA .. "`" .. twoA .. "`" .. twoB .. "`" .. twoB .. "`"
            three = threeA .. "`" .. threeA .. "`" .. threeB .. "`" .. threeB .. "`"

            oneMode = 21
            twoMode = 22
            threeMode = 23  
        end
    elseif (page == 4) then
        if titleDisplay then
            one = "<<<"
            two = "POWER"
            three = ">>>"
        else
            local oneA, twoA, threeA
            local oneB, twoB, threeB
            local power_f, power_r
           
            power_f = math.floor(CANServer_getAnalysisVar("FrontPower"))
            power_r = math.floor(CANServer_getAnalysisVar("RearPower"))      

            oneA, twoA, threeA = bargraph(power_f, 200)
            oneB, twoB, threeB = bargraph(power_r, 200)
            one = oneA .. "`" .. oneA .. "`" .. oneB .. "`" .. oneB .. "`"
            two = twoA .. "`" .. twoA .. "`" .. twoB .. "`" .. twoB .. "`"
            three = threeA .. "`" .. threeA .. "`" .. threeB .. "`" .. threeB .. "`"

            oneMode = 21
            twoMode = 22
            threeMode = 23  
        end
    elseif (page == 5) then
        if titleDisplay then
            one = "BALANCE"
            two = "REMAIN"
            three = "ENERGY"
        else
            if (CANServer_getAnalysisVar("BattBrickMultiplexer") == 1) then
                CANServer_setVar("battBalance", math.floor((CANServer_getAnalysisVar("BattBrickVoltageMax") - CANServer_getAnalysisVar("BattBrickVoltageMin")) * 1000))
            end
            one = CANServer_getVar("battBalance") .. "mv"
            two = CANServer_getAnalysisVar("EnergyRemaining") .. "kWh"
            three = CANServer_getAnalysisVar("NominalFullPackKWH") .. "kWh"

            oneMode = 31
            twoMode = 31
            threeMode = 31  
        end
    elseif (page == 6) then
        if titleDisplay then
            one = "BT TEMP%"
            two = "BT TEMP"
            three = "BT CLNT"
        else
            one = CANServer_getAnalysisVar("BattTempPct") .. "%"
            two = CANServer_getAnalysisVar("MinBattTemp") * 1.8 + 32 .. " F"
            three = string.format("%.2f", CANServer_getAnalysisVar("BattCoolantTemp") * 1.8 + 32) .. " F"
            if (CANServer_getAnalysisVar("BattCoolantRate") > 0) then
                three = ">" .. three
            end

            oneMode = 31
            twoMode = 31
            threeMode = 31  
        end
    else
        -- show a blank screen as the last page
        one = " "
        two = " "
        three = " "
       
        oneMode = 31
        twoMode = 31
        threeMode = 31
    end

    -- show brake indicator as subscript text, regardless of which page we're on
    local brake = CANServer_getAnalysisVar("BrakeLight")
    if (brake == 1) then
        two_ = "_"
    else
        two_ = " "
    end

    CANServer_setDisplayString(0, oneMode .. "," .. one .. "," .. one_ .. "," .. twoMode .. "," .. two .. "," .. two_ .. "," .. threeMode .. "," .. three .. "," .. three_)

    return
end

function bargraph(value, scale)
    local one = ""
    local two1 = ""
    local two2 = ""
    local three = ""
    local i
    value = math.floor(math.min(math.max((24) * (value) / (scale), -24), 24))
    if (value > 0) then
      two1 = "        "
        for i=1, value, 1
        do
          if (i > 8) then
            three = three .. "."  
          else
            two2 = two2 .. "."
          end
        end
        if (value < 8) then
            for i=1, 8 - value, 1
            do
                two2 = two2 .. " "
            end
        end
    elseif (value < 0) then
      two2 = "        "
        for i=-1, value, -1
        do  
          if (i < -8) then
            one = one .. "."
          else
            two1 = two1 .. "."
          end
        end
        if (value > -8) then
            for i=1, 8 + value, 1
            do
                two1 = " " .. two1
            end
        end
    end

    return one, two1 .. two2, three
end

main()

return

Analysis config


Code:


{
    "n": "BattAmps",
    "fid": 306,
    "sb": 16,
    "bl": 16,
    "f": -0.1,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "BattBrickMultiplexer",
    "fid": 818,
    "sb": 0,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattBrickVoltageMax",
    "fid": 818,
    "sb": 2,
    "bl": 12,
    "f": 0.002,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattBrickVoltageMin",
    "fid": 818,
    "sb": 16,
    "bl": 12,
    "f": 0.002,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattCoolantRate",
    "fid": 577,
    "sb": 0,
    "bl": 9,
    "f": 0.1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattCoolantTemp",
    "fid": 801,
    "sb": 0,
    "bl": 10,
    "f": 0.125,
    "so": -40,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattTempPct",
    "fid": 658,
    "sb": 50,
    "bl": 8,
    "f": 0.4,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BattVolts",
    "fid": 306,
    "sb": 0,
    "bl": 16,
    "f": 0.01,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "BrakeLight",
    "fid": 994,
    "sb": 0,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "CabinTemp",
    "fid": 579,
    "sb": 30,
    "bl": 11,
    "f": 0.1,
    "so": -40,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "DisplayOn",
    "fid": 12,
    "sb": 5,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "EnergyRemaining",
    "fid": 850,
    "sb": 11,
    "bl": 11,
    "f": 0.1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "FrontPower",
    "fid": 741,
    "sb": 0,
    "bl": 11,
    "f": 0.5,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "FrontTorque",
    "fid": 469,
    "sb": 24,
    "bl": 13,
    "f": 0.25,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "HvacStatusMultiplex",
    "fid": 579,
    "sb": 0,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "MaxDisChg",
    "fid": 594,
    "sb": 16,
    "bl": 16,
    "f": 0.01,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "MaxRegen",
    "fid": 594,
    "sb": 0,
    "bl": 16,
    "f": 0.01,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "MinBattTemp",
    "fid": 786,
    "sb": 44,
    "bl": 9,
    "f": 0.25,
    "so": -25,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "NominalFullPackKWH",
    "fid": 850,
    "sb": 0,
    "bl": 11,
    "f": 0.1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "OutsideTemp",
    "fid": 801,
    "sb": 40,
    "bl": 8,
    "f": 0.5,
    "so": -40,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "RearPower",
    "fid": 614,
    "sb": 0,
    "bl": 11,
    "f": 0.5,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "RearTorque",
    "fid": 472,
    "sb": 24,
    "bl": 13,
    "f": 0.25,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "RightScrollTicks",
    "fid": 962,
    "sb": 24,
    "bl": 6,
    "f": 1,
    "so": 0,
    "s": true,
    "bo": true,
    "v": 1
}
{
    "n": "SwitchStatusIndex",
    "fid": 962,
    "sb": 0,
    "bl": 2,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "UI_systemActive",
    "fid": 851,
    "sb": 8,
    "bl": 1,
    "f": 1,
    "so": 0,
    "s": false,
    "bo": true,
    "v": 1
}
{
    "n": "VehSpeed",
    "fid": 599,
    "sb": 12,
    "bl": 12,
    "f": 0.08,
    "so": -40,
    "s": false,
    "bo": true,
    "v": 1
}


----------



## Randy Spencer

Madmolecule said:


> CanServer Dual display script demo
> 
> A quick demo of its functionality


This made me buy another micro display from Josh. I now have three displays and probably don't get much air out of that slot anymore, had to tape down the middle display as it keeps coming out between the two 3D printed cases.

I tried using the bargraphs for the turn signals as you did, but I found I liked it better to use the LEDs at the end of the displays with the X0l command where I paste the value of the turn signal into the corresponding X. Also track the brake lites this way, as my red car doesn't show the red brake lites on the Nav Display too well.

It seems I don't drive the car w/o going in and changing something in the code. Some day I'll have to optimize it, but I am still waiting on the manual for the v2 updated features.


----------



## JWardell

I'm in trouble now!

__ https://twitter.com/i/web/status/1362155787267760134


> It seems I don't drive the car w/o going in and changing something in the code.


As long as you're having fun @Randy Spencer !


----------



## Madmolecule

Randy Spencer said:


> This made me buy another micro display from Josh. I now have three displays and probably don't get much air out of that slot anymore, had to tape down the middle display as it keeps coming out between the two 3D printed cases.
> 
> I tried using the bargraphs for the turn signals as you did, but I found I liked it better to use the LEDs at the end of the displays with the X0l command where I paste the value of the turn signal into the corresponding X. Also track the brake lites this way, as my red car doesn't show the red brake lites on the Nav Display too well.
> 
> It seems I don't drive the car w/o going in and changing something in the code. Some day I'll have to optimize it, but I am still waiting on the manual for the v2 updated features.


What are you using the third display for? I was thinking about adding a third one to provide passenger info. I do keep my two on the driver side separated by a couple inches to keep the airflow going. I would love to see future designs that had a small mount that would go in the air vent but the display would actually be bigger and rise above the air vent. But I also really do enjoy using them on a daily driving basis. I will try your turn signal style, I was trying to animate them with a multi colored sequence but never got it working properly. I like the brake light idea. I have always wanted a better understanding of the brake lights while on auto pilot, especially when it's using electronic braking.
I still use my warning for autopilot, but luckily it does not scare other drivers as much as it use to but knowing more about the brakes would make me more comfortable

If anyone is considering purchasing Josh's product, I would also like to mention that it is rocksolid. With TesLAX a lot of times I have to fiddle with reconnecting but the micro display and canserver works every time. Any issues I've had with it, has been my own programming mistakes, even though multiple times I was convinced there was a problem with unit.


----------



## TrevP

JWardell said:


> I'm in trouble now!
> 
> __ https://twitter.com/i/web/status/1362155787267760134
> As long as you're having fun @Randy Spencer !


Don't worry, any video I do will have a disclaimer about being "supply constrained"


----------



## Randy Spencer

I am not saying I NEED three displays, but your setup looked cool with two bargraphs. Actually I am having more trouble figuring out what to put on the second bargraph than what to feed the micro displays. I am always putting something new up as I stated above. Lots of times I just go into the code to fix a minor annoyance, like I moved something from the second line of text to it's own display and forgot to multiply by 10. I am really a terrible programmer.

I like your speed limit trick. I am trying to figure out a good way to display when the speed limit has changed so I can update my set speed. That Tesla bug that keeps grabbing the truck speed limit makes it not so useful, it nags me when the Set Speed is radically different from the *detected* Speed Limit. "Slow down, it's 55 MPH here" --No it's not!

But currently I have:


LeftCenterRightParkedCharge levelBattery Temp/Charge TimeBattery draw/charge in kWDrivingGrade / Altitude in ft or meters above 1000 ftBattery Temp/BalanceBattery draw/charge in kWor:MaxRegen in an orange bargraph when starting out
I already mentioned the brake and turn indicators using the blue LEDs at each end. I have yet to see the blind spot indicators but Josh's code is still in there.

I also have coded graphing the charge cycle, I am just trying to figure out how to clear the graph mode on the micro displays so each cycle doesn't show some of the old cycle. I was splitting time between the graph mode and then just the number of kWs, which toggled every 5 seconds, but that limited me to under half an hour of charge graphing, now with a dedicated display I'll be able to slow the updates based on how long the charge will take. My local free CHAdeMO takes over an hour on a really empty battery. Hello Netflix!

I like your AutoPilot sign, I just wish Josh had one that I could program and display something like it, based on realtime data


----------



## Ren001

@Madmolecule

Just a short question:

Is that code still working in your car? I don't get the BSM arrows on the display, despite the cars being shown in red on the main display.



Code:


    -- Left and Right Blindspot Arrow Overlay
    -- Sets Left Blindspot Arrow Overlay Variable
        local bsl = CANServer_getAnalysisVar("BSL");
        local bld = 0;
        local r0time = 100;
    -- Sets Right Blindspot Arrow Overlay Variable     
        local bsr = CANServer_getAnalysisVar("BSR");
        local brd = 0;
        local r1time = 100;

-- Value of 1 will Display Left Arrow Ovlerlay
    if (bsl == l or bsl == 2) then
           bld = 1;
            r0time = 800;
    end
-- Value of 2 will Display Right Arrow Ovlerlay
        if (bsr == l or bsr == 2) then
            brd = 2;
           r1time = 800;
    end
-- If bld value > 0 display the Left Blindspot overlay on Display 0
    if (bld > 0) then
        CANServer_setDisplayString(0, bld .. "v63488c6m1000r")
    end
-- If brd value > 0 display the Right Blindspot overlay on Display 1
    if (brd > 0) then
        CANServer_setDisplayString(1, brd .. "v63488c6m1000r")
    end

Many thanks for your help!


----------



## Madmolecule

I’ve never been able to get the Blindspot detection to work. I’ve been meaning to troubleshoot it. The overlay arrows look real nice on the display. I’ve also never been able to get the construction zone to work reliably. I plan on messing with it more next week.


----------



## Ren001

Thanks a lot for the feedback!
I saw it working here






and thought its another problem with model 3s in Europe...


----------



## Randy Spencer

Yeah, I left the code in my setup but have never seen the arrows either. I figured I broke it, good to know it's external to my setup.


----------



## JWardell

The Blind spot arrows definitely worked last summer, but they are difficult to trigger considering you must have your blinker on and a car has to be in just the right spot, and red on the screen. It's not something I run personally so I will have to also see if tesla changed things again.


----------



## Madmolecule

I found a good discrete connector that works well with the dual microdisplay. The ends are magnetically coupled and rotate so they can be used on either side. The cables are a little bit long but can be hidden

Magnetic micro usb


----------



## JWardell

Is anyone out there running Teslamate and interested in adding CANserver support to it?
I know I've mentioned it a few times in my videos, but I can see so many advantages to integrating Canserver's logs to Teslamate (or Teslogger).
Especially since Tesla has recently been going after app developers, and I have this bad feeling they might start locking down the API next...
--Obtain all your data on your own hardware and networks, no need to use Tesla's API at all
--Logging of 3000+ signals, not just the few dozen in the API
--Continuous logging that doesn't disappear when your car is out of LTE range
--Use 1sec interval logs for small file sizes, but still much more than the 60 sec API resolution
--Automatically retrieve and proccess logs as soon as your car connects to your home Wifi
etc..


----------



## Eugenius

JWardell said:


> Is anyone out there running Teslamate and interested in adding CANserver support to it?
> I know I've mentioned it a few times in my videos, but I can see so many advantages to integrating Canserver's logs to Teslamate (or Teslogger).
> Especially since Tesla has recently been going after app developers, and I have this bad feeling they might start locking down the API next...
> --Obtain all your data on your own hardware and networks, no need to use Tesla's API at all
> --Logging of 3000+ signals, not just the few dozen in the API
> --Continuous logging that doesn't disappear when your car is out of LTE range
> --Use 1sec interval logs for small file sizes, but still much more than the 60 sec API resolution
> --Automatically retrieve and proccess logs as soon as your car connects to your home Wifi
> etc..


I would like to have TeslaLogger Integration (I heard you are already in contact with EMDS? Or was it about selling CanServer in EU?)


----------



## JWardell

Canserver firmware 2.0 is finally released!

Lots of great new features as highlighted in my last video, and solid reliability.

If your canserver was shipped in 2021, it already has a beta version of v2 on it and just needs upload of the firmware bins to the web interface.
Earlier versions can either be USB flashed or follow a slightly more involved web interface upgrade...all instructions are in the Wiki.

https://github.com/joshwardell/CANserver/releases/tag/2.0.0


----------



## amund7

I'll crosspost this here too:

scan my tesla 2.2.1 beta/testflight with JWardell CanServer support! 
https://jwardell.myshopify.com/collections/all

IOS https://testflight.apple.com/join/vjt53f4N

Android, still in review in Google Play, will show as an upgrade when it's cleared: 
(from Android phone) https://play.google.com/store/apps/details?id=com.emon.canbus.tesla 
(from web) https://play.google.com/apps/testing/com.emon.canbus.tesla


----------



## Ren001

JWardell said:


> Canserver firmware 2.0 is finally released!


And update worked fine. Good work!


----------



## Garlan Garner

So @JWardell,

Is your hardware Bluetooth CAN transmitter identical to the ODB Bluetooth adapter that is recommended from ScanMyTesla - "in function"?


----------



## amund7

Garlan Garner said:


> So @JWardell,
> 
> Is your hardware Bluetooth CAN transmitter identical to the ODB Bluetooth adapter that is recommended from ScanMyTesla - "in function"?


It's harder - better - faster - stronger 

Let me give some details:
Where OBDLINKs give 1000 packets per second
and ELM327 give 80 packets per second
CanServer gives ALL the packets. (~2000 depending on which car and what it's doing)
Not that anyone needs more than what the screen can refresh, which OBDLINK already does. But some people are having hassles with OBDLINKS hanging or not wanting to connect. In our tests so far, and mind you this is the first beta of the app with this stuff in it, it can only get better, but it's already so smooth, connects in a second, and after redoing some code a few days ago it auto reconnects very nicely, even when wifi switches etc. Much kudos to Pyjamasam for writing most of the code.
Also for IOS, the OBDLINK is a bit of hassle where you need to go to settings to connect it, sometimes. And sometimes it just refuses. So at least, CanServer gives another option.
Add to that it can also work across your home wifi, so you can enjoy the app from your couch.
Add to that, all the other features of CanServer (logging, scripting, displays, and lots of future possibilities)

I should add it's not bluetooth, but Wifi.


----------



## pyjamasam

Ren001 said:


> And update worked fine. Good work!


Did you update from v1? Through the web browser or via a USB cable? I am curious to know what your experience was and if there is anything I can improve both in the documentation or the code it's self.

chris.


----------



## Ren001

@pyjamasam I updated from an early V2. This version had no online update button, but the ability to update via file (in the web interface)
For me it was unusual to select a .zip file for the update, but it worked out perfect!
My Tesla is sitting in the carport with Wifi access, so I can do "everything" from my workplace...


----------



## Garlan Garner

amund7 said:


> It's harder - better - faster - stronger
> 
> Let me give some details:
> Where OBDLINKs give 1000 packets per second
> and ELM327 give 80 packets per second
> CanServer gives ALL the packets. (~2000 depending on which car and what it's doing)
> Not that anyone needs more than what the screen can refresh, which OBDLINK already does. But some people are having hassles with OBDLINKS hanging or not wanting to connect. In our tests so far, and mind you this is the first beta of the app with this stuff in it, it can only get better, but it's already so smooth, connects in a second, and after redoing some code a few days ago it auto reconnects very nicely, even when wifi switches etc. Much kudos to Pyjamasam for writing most of the code.
> Also for IOS, the OBDLINK is a bit of hassle where you need to go to settings to connect it, sometimes. And sometimes it just refuses. So at least, CanServer gives another option.
> Add to that it can also work across your home wifi, so you can enjoy the app from your couch.
> Add to that, all the other features of CanServer (logging, scripting, displays, and lots of future possibilities)
> 
> I should add it's not bluetooth, but Wifi.


Thanks for the detailed response.

Did my research.

I'm ordering one now.


----------



## Madmolecule

Ren001 said:


> @pyjamasam I updated from an early V2. This version had no online update button


Hopefully Josh will add a button to let us select for early software releases. It won't do anything, just like Tesla's, but make us feel better.

Of course I was able to have problems with the update that were self-inflicted. Although I am probably the lobe case, but you should not have a wireless access name more than 32 characters (WindowsBackdoorTrojanainstaller32). I added another access point with a smaller name and that fixed it.

The Tesla button is very similar to the elevator door close buttons. Most of them are just fake to make you feel better and give you something to do. Here is where the elevator close button fell off.


----------



## pyjamasam

Ren001 said:


> @pyjamasam I updated from an early V2. This version had no online update button, but the ability to update via file (in the web interface)
> For me it was unusual to select a .zip file for the update, but it worked out perfect!
> My Tesla is sitting in the carport with Wifi access, so I can do "everything" from my workplace...


Awesome. Glad to hear it worked right. I haven't heard any experiences updating from a v1 firmware yet. Its a more involved process and I am curious to see if I managed to make it easy enough 

Thanks.

chris.


----------



## pyjamasam

Madmolecule said:


> Hopefully Josh will add a button to let us select for early software releases. It won't do anything, just like Tesla's, but make us feel better ...


I am thinking about adding that as we start to move into releases after 2.0.0. There are going to be updates and things I want to try but don't want to roll it out to the entire "fleet". hahaha.

On the other hand you can just jump on over and join us on discord where I usually post pre-releases as well.

https://discord.gg/zc2fQ5UMae

chris.


----------



## JWardell

Oh, you want a early access placebo button like the one in your car? Sure, we can add a button that does nothing. :tearsofjoy:


----------



## Madmolecule

I've just run into this software. I have never used it. It would be great if they came out with a canserver version. I wish Tesla, scan My Tesla or someone would use the data to provide more recommendations for driving, charging and maintenance. I do believe it's coming as we need to turn the data into information.

Gofar


----------



## Madmolecule

JWardell said:


> Oh, you want a early access placebo button like the one in your car? Sure, we can add a button that does nothing. :tearsofjoy:


The rumors are version 3 will require a premium monthly membership, but will include traffic cone alerts.


----------



## pyjamasam

Madmolecule said:


> I've just run into this software. I have never used it. It would be great if they came out with a canserver version. I wish Tesla, scan My Tesla or someone would use the data to provide more recommendations for driving, charging and maintenance. I do believe it's coming as we need to turn the data into information.
> 
> Gofar


One of the struggles of using the CAN data for things like this is that if Tesla changes that data then the apps break. Its one thing for apps like SMT and tesLax to show you data, and help you understand how your car is working, but its gets murky if you are relying on that CAN data to drive features for other apps. Its appealing because of the volume of data, as well as the volume of types of data that's accessible. But it's going to be a challenge.

We have been having conversations on how we could better keep track of how to decode the data and cross reference that against firmware versions such that the decoding can be more _reliable. _But that's all it has been so far. Conversations. But hopefully those conversations will turn into something more. Such that we'll have a nice way to power more apps that are more then "Show me what's going on". As you say - turn the data into information.

chris.


----------



## pyjamasam

Madmolecule said:


> The rumors are version 3 will require a premium monthly membership, but will include traffic cone alerts.


Shhh. Don't give away all the secrets...

Though it will only support traffic cones that are tipped over.... Maybe upside down cones if I can get the ML model running fast enough. But definitely not upright cones. I don't see any value in the CANServer showing those. 

chris.


----------



## Garlan Garner

I know I'm late to the party...but...how does one connect scann my tesla to the @JWardell unit? I finally plugged it in and I'm able to recognize it on my phone via wifi.


----------



## JWardell

Garlan Garner said:


> I know I'm late to the party...but...how does one connect scann my tesla to the @JWardell unit? I finally plugged it in and I'm able to recognize it on my phone via wifi.


Do you have the special beta that @amund7 made that supports it? It's not in the release version yet


----------



## Garlan Garner

amund7 said:


> I'll crosspost this here too:
> 
> scan my tesla 2.2.1 beta/testflight with JWardell CanServer support!
> https://jwardell.myshopify.com/collections/all
> 
> IOS https://testflight.apple.com/join/vjt53f4N
> 
> Android, still in review in Google Play, will show as an upgrade when it's cleared:
> (from Android phone) https://play.google.com/store/apps/details?id=com.emon.canbus.tesla
> (from web) https://play.google.com/apps/testing/com.emon.canbus.tesla


I attempted to update to 2.2.1,

I opened the Google Play app.

I see "scan my tesla" with a green "Update" button next to it. I press Update - the picture gets smaller then immediately:

The Screen flashes the following:

Pending..
Verified by Play Protect

Then immediately goes back to the update button and doesn't update anything.

What can I do?


----------



## Garlan Garner

JWardell said:


> Do you have the special beta that @amund7 made that supports it? It's not in the release version yet


No, I didn't have the special beta. I'm trying to get it to install.

Is there any way that you know of to keep CAN server awake when you aren't in it?

I see it alive and well when the door is open and I'm not in the car. As soon as I close the door it turns off ( http://192.168.4.1 ) goes away.


----------



## JWardell

Garlan Garner said:


> No, I didn't have the special beta. I'm trying to get it to install.
> 
> Is there any way that you know of to keep CAN server awake when you aren't in it?
> 
> I see it alive and well when the door is open and I'm not in the car. As soon as I close the door it turns off ( http://192.168.4.1 ) goes away.


If you have a dual bus canserver connected to the chassis connector under the seat, the car powers that 12v off as soon as you exit the car.
If you abandon the chassis bus and instead connect and power by the OBD harness then it should stay on if the car is awake...depending on how that harness is wired.
Another workaround I've seen is keeping the power switch on the side off, but plugging a USB cable in for power, which then will stay powered while the car is awake


----------



## Garlan Garner

JWardell said:


> If you have a dual bus canserver connected to the chassis connector under the seat, the car powers that 12v off as soon as you exit the car.
> If you abandon the chassis bus and instead connect and power by the OBD harness then it should stay on if the car is awake...depending on how that harness is wired.
> Another workaround I've seen is keeping the power switch on the side off, but plugging a USB cable in for power, which then will stay powered while the car is awake


Excellent.

Thanks for all of the suggestions. I will explore them all.


----------



## Submash

Is there a way how I can have physical buttons/switches to send signals to CanServer scripts?
Like, for instance, to change modes of what would be shown on displays?


----------



## pyjamasam

Submash said:


> Is there a way how I can have physical buttons/switches to send signals to CanServer scripts?
> Like, for instance, to change modes of what would be shown on displays?


The micro displays support 2 input buttons each. You can access those via the LUA function


Code:


CANServer_getDisplayInput(displayid, inputside)

Reference: https://github.com/joshwardell/CANserver/wiki/CANServer-v2-Scripting#microdisplay-methods

If you aren't using microdisplays you can emulate the same mechanism they are using by making a HTTP post to http://<canserverip>/post[0,1,2,3] (the number corresponds to the displayid you want to post the input info for) that contains two bytes. Byte 1 1 is the left side button, and byte 2 is the right side button. The bytes need to be either a "0" or a "1" - ascii 0x30 or 0x31. (0 denoting a low state, 1 denoting a hight state)
Then you can use the referenced LUA function.

If you do have existing microdisplays and aren't using their hardware to do this, you might want to use a displayid that you aren't currently using with real hardware. Otherwise your stuff and the real requests from the micro display will fight. (for example if you have two displays and are using id 0 and 1, but want to make other hardware that has your buttons, you could use display id 2 for that hardware)

Hope that helps. Let me know if you have issues or other questions.

chris.


----------



## Submash

pyjamasam said:


> The micro displays support 2 input buttons each. You can access those via the LUA function
> 
> 
> Code:
> 
> 
> CANServer_getDisplayInput(displayid, inputside)
> 
> Reference: https://github.com/joshwardell/CANserver/wiki/CANServer-v2-Scripting#microdisplay-methods
> 
> If you aren't using microdisplays you can emulate the same mechanism they are using by making a HTTP post to http://<canserverip>/post[0,1,2,3] (the number corresponds to the displayid you want to post the input info for) that contains two bytes. Byte 1 1 is the left side button, and byte 2 is the right side button. The bytes need to be either a "0" or a "1" - ascii 0x30 or 0x31. (0 denoting a low state, 1 denoting a hight state)
> Then you can use the referenced LUA function.
> 
> If you do have existing microdisplays and aren't using their hardware to do this, you might want to use a displayid that you aren't currently using with real hardware. Otherwise your stuff and the real requests from the micro display will fight. (for example if you have two displays and are using id 0 and 1, but want to make other hardware that has your buttons, you could use display id 2 for that hardware)
> 
> Hope that helps. Let me know if you have issues or other questions.
> 
> chris.


That's great, thank you very much! I will try.

I just want to share my experience with racing needs in general.

There are few things that can be done now:

*Real-time lap data* - predictive timing, entrance/exit speeds vs best, time to brake/exit point, and so on.
Usually, it's a tablet with a Harry LapTimer/RaceChrono/TrackAddict and high-speed GPS like Vbox Sport
*Quick Diagnostics Dashboard* - ScanMyTesla can do that job from the same tablet as a lap timer and with a CanServer it's finally more reliable.
But few other things I don't see how to do without going full Motec/AIM where it's 10-100x cost in parts and time.

*Reading of physical d/a high-speed sensors*
Wired data input controller with ~10 D/A high-speed inputs per box that can be connected to all kinds of temp/travel/distance/IR/wheel speed sensors
CanServer wired connection to the chain of such boxes, that configures and reads back data from them
It's possible such a box already exists with CAN bus control, but need an access to CAN out from scripts

*Automation of actuators/pumps/fans/solenoids/etc*
Wired output control box with ~16 digital+analog high-speed outputs controlled by CanServer script
Maybe such a box already exists similar to the INPUT box or it's even the same one
continuous non-stop script cycle instead of a 40ms scheduler?
additional memory to run large LUA scripts might be needed

*Near the line of sight alerts*
to show critical car data, automation states, etc
mini-displays and bar graphs are almost ideal for that
but they should be very high brightness and have script control for RGB color and blinking sequence

*Steering Wheel mechanical controls*
you need real motorsport dials/buttons/switches to change displays and automation modes - there is no time or ability to use any screens on the track
a CanServer scripts connection to something like https://granitedevices.com/wiki/Simucube_wireless_wheel_system 

*Detailed synchronized logs for offline study*
video, GPS, CAN, physical sensors should be collected by lap timer software
CanServer aggregates dual CAN and physical sensors data in a single timecoded data stream sent to to the lap timer with local SD backup

Maybe it's possible to do some of those things:

two dual bus CanServers talk with each other - one for external CAN I/O, another for the car
connect to some decent wireless buttons receiver somehow?
support Harry LapTimer/RaceChrono/TrackAddict
make new RGB HB mini displays 
maybe change all connections to lockable, to withstand vibrations on the track?
What do you think about that?
Thanks!


----------



## Ren001

Submash said:


> video, GPS, CAN, physical sensors should be collected by lap timer software


This can be achieved right now in a combination of Racechrono Data, GoPro Video and Tesla track mode data.

Regarding the other requirements you should talk to Avi Fischer and Ben Schaffer of unplugged performance (avi(at)unpluggedperformance.com), they have done a number of these things in their model 3 racing at Pikes Peak.


----------



## Submash

Ren001 said:


> This can be achieved right now in a combination of Racechrono Data, GoPro Video and Tesla track mode data.
> 
> Regarding the other requirements you should talk to Avi Fischer and Ben Schaffer of unplugged performance ([email protected]), they have done a number of these things in their model 3 racing at Pikes Peak.


You can achieve that (except physical sensors), but it's tedious to sync them together and there is a clock drift as well over long runs.
Some last laps of GPS, CAN, and the video shifts in time from each other.

UPP uses the Motec system, I know. And as I've said - yes, you can do those things on Motec or AIM and some even on Racelogic.
But those are not amateur racing prices and it's a lot of work to have it done with a community that is opposite of open source...


----------



## amund7

Garlan Garner said:


> I attempted to update to 2.2.1,
> 
> I opened the Google Play app.
> 
> I see "scan my tesla" with a green "Update" button next to it. I press Update - the picture gets smaller then immediately:
> 
> The Screen flashes the following:
> 
> Pending..
> Verified by Play Protect
> 
> Then immediately goes back to the update button and doesn't update anything.
> 
> What can I do?


The google play app behaves very strangely, especially with the entering/exiting beta program. What I've found works is, search for another app, enter it's page, then go back to scan my tesla page, and the buttons and text seem to have been refreshed. Sometimes the Google system itself is also slow, the instruction even says it can take 'a few hours'... just try again later. Super annoying and confusing.

To get back out of beta, you need to uninstall the beta then install the original app, with help from the steps above.


----------



## JWardell

Submash said:


> That's great, thank you very much! I will try.
> 
> I just want to share my experience with racing needs in general.
> 
> There are few things that can be done now:
> 
> *Real-time lap data* - predictive timing, entrance/exit speeds vs best, time to brake/exit point, and so on.
> Usually, it's a tablet with a Harry LapTimer/RaceChrono/TrackAddict and high-speed GPS like Vbox Sport
> *Quick Diagnostics Dashboard* - ScanMyTesla can do that job from the same tablet as a lap timer and with a CanServer it's finally more reliable.
> But few other things I don't see how to do without going full Motec/AIM where it's 10-100x cost in parts and time.
> 
> *Reading of physical d/a high-speed sensors*
> Wired data input controller with ~10 D/A high-speed inputs per box that can be connected to all kinds of temp/travel/distance/IR/wheel speed sensors
> CanServer wired connection to the chain of such boxes, that configures and reads back data from them
> It's possible such a box already exists with CAN bus control, but need an access to CAN out from scripts
> 
> *Automation of actuators/pumps/fans/solenoids/etc*
> Wired output control box with ~16 digital+analog high-speed outputs controlled by CanServer script
> Maybe such a box already exists similar to the INPUT box or it's even the same one
> continuous non-stop script cycle instead of a 40ms scheduler?
> additional memory to run large LUA scripts might be needed
> 
> *Near the line of sight alerts*
> to show critical car data, automation states, etc
> mini-displays and bar graphs are almost ideal for that
> but they should be very high brightness and have script control for RGB color and blinking sequence
> 
> *Steering Wheel mechanical controls*
> you need real motorsport dials/buttons/switches to change displays and automation modes - there is no time or ability to use any screens on the track
> a CanServer scripts connection to something like https://granitedevices.com/wiki/Simucube_wireless_wheel_system
> 
> *Detailed synchronized logs for offline study*
> video, GPS, CAN, physical sensors should be collected by lap timer software
> CanServer aggregates dual CAN and physical sensors data in a single timecoded data stream sent to to the lap timer with local SD backup
> 
> Maybe it's possible to do some of those things:
> 
> two dual bus CanServers talk with each other - one for external CAN I/O, another for the car
> connect to some decent wireless buttons receiver somehow?
> support Harry LapTimer/RaceChrono/TrackAddict
> make new RGB HB mini displays
> maybe change all connections to lockable, to withstand vibrations on the track?
> What do you think about that?
> Thanks!


Yikes, well I guess you are highlighting why the Motec system is $3000. Clearly a lot of computing power and hardware is needed for all of those features. Many are well beyond the capability or even possibility of the CANserver. But you can achieve a lot of useful functionality, especially if you pair the server with a phone app or computer to do something with the data.
Remember the main purpose is to _serve_ the data. So the canserver can log or transmit many of that information, including wheel speeds/ticks, full speed GPS, speeds, power, etc and all the thousands of signals that are already present in the Tesla's CAN networks. An app could be made to use that to present live lap and race information for example.
The internal canserver scripting is more for light duty usage, mainly to handle any microdisplays and their two I/Os, but newer canservers do also have 5 onboard IOs, two of which can be fitted with relays, intended to control things such as amplifiers. But heavy duty processing of data should be performed with a connected app.


----------



## pyjamasam

Wooo! Lots to unpack here. :thumbsup: Lets see if I can work my way through it.



Submash said:


> I just want to share my experience with racing needs in general.
> 
> There are few things that can be done now:
> 
> *Real-time lap data* - predictive timing, entrance/exit speeds vs best, time to brake/exit point, and so on.
> Usually, it's a tablet with a Harry LapTimer/RaceChrono/TrackAddict and high-speed GPS like Vbox Sport
> *Quick Diagnostics Dashboard* - ScanMyTesla can do that job from the same tablet as a lap timer and with a CanServer it's finally more reliable.


Thats GREAT to hear! I am glad you had a good experience with it. @amund7 has been improving the code in his latest SMT betas greatly, and @All About Jake has some really nice support for the CANServer in tesLAX already. I'd like to see if RaceChrono support can happen, and I have made an initial reach out to them but there isn't much progress there yet. Hopefully in the future.



Submash said:


> But few other things I don't see how to do without going full Motec/AIM where it's 10-100x cost in parts and time.
> 
> *Reading of physical d/a high-speed sensors*
> Wired data input controller with ~10 D/A high-speed inputs per box that can be connected to all kinds of temp/travel/distance/IR/wheel speed sensors
> CanServer wired connection to the chain of such boxes, that configures and reads back data from them
> It's possible such a box already exists with CAN bus control, but need an access to CAN out from scripts


Hmm this is an interesting one. We are pushing the current hardware close to its limit right now. There are some expansion options (for example the exposed IO pins do include some i2c pins that might be possible to use to interface with external devices) but as @JWardell said, a lot of your example items are actually already available via the CAN frames the car is already emmiting. While it might not be all the items, there are a TON. Maybe there is a good middle ground in the data there somewhere 



Submash said:


> *Automation of actuators/pumps/fans/solenoids/etc*
> Wired output control box with ~16 digital+analog high-speed outputs controlled by CanServer script
> Maybe such a box already exists similar to the INPUT box or it's even the same one
> continuous non-stop script cycle instead of a 40ms scheduler?
> additional memory to run large LUA scripts might be needed


Right now there are 5 digital IO pins that can act either as an INPUT or an OUTPUT. These are controlable from the scripting engine.
*CANServer_getPinState(pinnumber)* and *CANServer_setPinState(pinnumber, pinstate)* are the LUA funtions you want to look into.

As for the continuous script, right now its all a balacing act to get everything performing within the limits of the hardware, and the load the car puts on it from the busses. It might be possible to lower the scan rate for the script, but that would take some testing. I can do some expermenting.

Additional memory is also a hardware challange. We are using just about every available IO pin to connect to all the existing pieces. There would need to be a little bit of re-work to allow the addition, so possibly in a future hardware revistion. But the present 2.x hardware base can't have it added. But depending on the complexity of the script, I am not sure it will use up THAT much memory. I'd be interested to see some examples of a script that starts to really impact free memory. Arguably I don't push mine that hard in day to day use, but I HAVE tested it during development, though that never makes up for what people get up to in real life 



Submash said:


> *Near the line of sight alerts*
> to show critical car data, automation states, etc
> mini-displays and bar graphs are almost ideal for that
> but they should be very high brightness and have script control for RGB color and blinking sequence


The display setup is very flexable right now. There are just two simple HTTP calls that the existing microdisplays use. /disp[0,1,2,3] and /post[0,1,2,3] Technically any device/software that can connect to wifi and make similar calls could consume the data as well.

ESP8266 based Giant Red LED! Sure thing. That would work.

One of the things I am working on for the next minor firmware release is support for using websockets to consume both raw can data as well as processed analysis items. Once that interface is complete it will make it a little easier for external hardware/software to consume arbitrary outputs (and even support arbitrary inputs).



Submash said:


> *Steering Wheel mechanical controls*
> you need real motorsport dials/buttons/switches to change displays and automation modes - there is no time or ability to use any screens on the track
> a CanServer scripts connection to something like https://granitedevices.com/wiki/Simucube_wireless_wheel_system


Along the same lines as the reponse to the above item, having a more advanced setup would allow use of hardware to do exactly this. A neat "button bar" that gets attached to your steering wheel would be kinda cool. And by leveraging the CANServer as a data source (and consuming IO data from the button bar) you could do some neat stuff.



Submash said:


> *Detailed synchronized logs for offline study*
> video, GPS, CAN, physical sensors should be collected by lap timer software
> CanServer aggregates dual CAN and physical sensors data in a single timecoded data stream sent to to the lap timer with local SD backup


The CAN data has a timestamp in it (in a model 3 there are actually two differnt ones). As well as the GPS timestamp.

If the other devices have a similar GPS timestamp then its plausable that you can correlate the data after the fact.

The Logging engine also supports adding logging "marks" (LUA method *CANServer_addLogMark([markname])*) which you can either call without a parameter and just get a numeric mark that incriments for each call, or pass a string parameter that gets put into the log file.

You could call this on a button push each lap for example. If an input gets shared between devices you could even use it as a form of "clapper" to syncronize disseperate logging systems on different devices.



Submash said:


> Maybe it's possible to do some of those things:
> 
> two dual bus CanServers talk with each other - one for external CAN I/O, another for the car
> connect to some decent wireless buttons receiver somehow?
> support Harry LapTimer/RaceChrono/TrackAddict
> make new RGB HB mini displays
> maybe change all connections to lockable, to withstand vibrations on the track?



There could be support for a "syncronization pulse" that could be used from a master to a slave CANServer. It would take a little software engineering to sort out, but maybe something that is in the relm of possible. If would for sure be down the road update wise tough .
I think the buttons should be easily possbile based on comments above. :thumbsup: Maybe not super easy in the v2.0 firmware, but still doable, but with the next minor version it should make it more simple.
If I can get some traction with RaceChrono that would be really nice. If and when its supported we'll be sure to announce it!
I may or may not be in possession of some new hardware goodies from Josh that may or may not fit this desire....
Thats a good idea. I'll leave that one to Josh for a future hardware revision.

Hopefully that helps address some of your questions and concerns.

Thanks for taking such an interest in the system, and putting it to the test. 
Also thanks for taking the time to offer up your thoughs. I always like to hear how people are using it and their ideas around how to make it better.

chris.


----------



## Madmolecule

pyjamasam said:


> Wooo! Lots to unpack here. :thumbsup: Lets see if I can work my way through it.
> 
> Thats GREAT to hear! I am glad you had a good experience with it. @amund7 has been improving the code in his latest SMT betas greatly, and @All About Jake has some really nice support for the CANServer in tesLAX already. I'd like to see if RaceChrono support can happen, and I have made an initial reach out to them but there isn't much progress there yet. Hopefully in the future.
> 
> Hmm this is an interesting one. We are pushing the current hardware close to its limit right now. There are some expansion options (for example the exposed IO pins do include some i2c pins that might be possible to use to interface with external devices) but as @JWardell said, a lot of your example items are actually already available via the CAN frames the car is already emmiting. While it might not be all the items, there are a TON. Maybe there is a good middle ground in the data there somewhere
> 
> Right now there are 5 digital IO pins that can act either as an INPUT or an OUTPUT. These are controlable from the scripting engine.
> *CANServer_getPinState(pinnumber)* and *CANServer_setPinState(pinnumber, pinstate)* are the LUA funtions you want to look into.
> 
> As for the continuous script, right now its all a balacing act to get everything performing within the limits of the hardware, and the load the car puts on it from the busses. It might be possible to lower the scan rate for the script, but that would take some testing. I can do some expermenting.
> 
> Additional memory is also a hardware challange. We are using just about every available IO pin to connect to all the existing pieces. There would need to be a little bit of re-work to allow the addition, so possibly in a future hardware revistion. But the present 2.x hardware base can't have it added. But depending on the complexity of the script, I am not sure it will use up THAT much memory. I'd be interested to see some examples of a script that starts to really impact free memory. Arguably I don't push mine that hard in day to day use, but I HAVE tested it during development, though that never makes up for what people get up to in real life
> 
> The display setup is very flexable right now. There are just two simple HTTP calls that the existing microdisplays use. /disp[0,1,2,3] and /post[0,1,2,3] Technically any device/software that can connect to wifi and make similar calls could consume the data as well.
> 
> ESP8266 based Giant Red LED! Sure thing. That would work.
> 
> One of the things I am working on for the next minor firmware release is support for using websockets to consume both raw can data as well as processed analysis items. Once that interface is complete it will make it a little easier for external hardware/software to consume arbitrary outputs (and even support arbitrary inputs).
> 
> Along the same lines as the reponse to the above item, having a more advanced setup would allow use of hardware to do exactly this. A neat "button bar" that gets attached to your steering wheel would be kinda cool. And by leveraging the CANServer as a data source (and consuming IO data from the button bar) you could do some neat stuff.
> 
> The CAN data has a timestamp in it (in a model 3 there are actually two differnt ones). As well as the GPS timestamp.
> 
> If the other devices have a similar GPS timestamp then its plausable that you can correlate the data after the fact.
> 
> The Logging engine also supports adding logging "marks" (LUA method *CANServer_addLogMark([markname])*) which you can either call without a parameter and just get a numeric mark that incriments for each call, or pass a string parameter that gets put into the log file.
> 
> You could call this on a button push each lap for example. If an input gets shared between devices you could even use it as a form of "clapper" to syncronize disseperate logging systems on different devices.
> 
> 
> There could be support for a "syncronization pulse" that could be used from a master to a slave CANServer. It would take a little software engineering to sort out, but maybe something that is in the relm of possible. If would for sure be down the road update wise tough .
> I think the buttons should be easily possbile based on comments above. :thumbsup: Maybe not super easy in the v2.0 firmware, but still doable, but with the next minor version it should make it more simple.
> If I can get some traction with RaceChrono that would be really nice. If and when its supported we'll be sure to announce it!
> I may or may not be in possession of some new hardware goodies from Josh that may or may not fit this desire....
> Thats a good idea. I'll leave that one to Josh for a future hardware revision.
> 
> Hopefully that helps address some of your questions and concerns.
> 
> Thanks for taking such an interest in the system, and putting it to the test.
> Also thanks for taking the time to offer up your thoughs. I always like to hear how people are using it and their ideas around how to make it better.
> 
> chris.


I don't race, but I'm certainly excited about RGB


----------



## Submash

Thanks for answers, guys, I really appreciate.

I'd like to comment about those 3-8k priced systems like Motec and AIM. They have no scripting, no open source and they use pretty much same 20 years old CPUs. No magic - they are very limited in what you can do. Its like 21 century didn't happen there.

Their target is prosumer.

I had high hopes in RaceCapture and dedicated tons of my time to it. But it all crashed into factual limitations of kilobytes of internal memory and weak processors. I was begging for it and they didn't do it. I rewrote code 5 times to fit in memory and failed. Years later and they didn't make new HW.

Can you, please, explain to me a mystery of this approach?

Why not to take something like a cheap BeagleBone Black with wifi and native dual CAN support, add CAN transmitters and get performance 10x more than now? https://www.beyondlogic.org/adding-can-to-the-beaglebone-black/

What is missing now is open source expandable racing platform that can be used by mass market. ~100$ computers have AI cores in them, AI is more and more general commodity for developers. Ethernet connected cameras might not only be used for recording, but for processing of images.

There are tons of things can be done with higher computer power on the track. Think suspension, tires, brakes sensors and in-depth real-time analysis that can be programmed by somebody and used by many. Think real-time analysis of position to help with training. Or active aero projects. Or active suspension based on gps data. Or marketplace of plugins for expansion of functionality.

Right now all that is available only for pro teams, but there are tons of developers among amateur racing enthusiasts.

But no hardware with basic infrastructure.

There is no point in spending time on something that exists. Sensors, gps, IO modules more and more move to CAN bus. Laptimers also available. Ready to use certified boards exist too.

I'm quite certain that this can be done commercially successful. I would even invest my money into the team.

Look at Arduino and Pi success. There is a niche for proper racing application. Who else actually needs all those logs?


----------



## thierryb

I have developped racing softwares for myself since many years and it helps me to win many FIA E-Rally. In these rallies you have to consume the less energy as you can but respecting a roadbook including imposed speed changes. The Jwardell canserver will replace the can server I have developped. This way I will not spend my time to improve my can server but only to improve my racing softwares. 
@Submash I do not sale or give my software, except to friends. In fact at the beginning the first software was developped to try to consume the less than I can in my daily life with my now dead Prius. Then some of my friends wanted to participate to the New Energy Rally of Monte Carlo in 2012 with their Prius, and I adapted my software for them. Then to better help them I decided to participate myself to the New Energy of Monte Carlo in 2012.
You will find many hardware and software for this type of rallies, but I prefer to develop mine. This way I can adapt it immediately, including during rallies, to take into account specific rules of each rallies. I do not want to give it to others, or to sale it, or to adapt it to others because often people wants support that I can not give to them, because I have not the time too.
Developping a canserver is not easy and takes time, but specifications are simple: get data from the car and make it available reliably, rapidly and easily.
Concerning racing software, specifications can change from one person to the other and could depend of one type of race or the other. You wants to integrate the data of the canserver with hardware and video, it is not easy, and again will depend of each needs.
I just bought my JWardell canserver, I will receive it soon, I will adapt my softwares to it, then if I can easily adapt one of them for your needs I will do it. But, I do not manage other hardware, except GPS, or video. If you need buttons, you will be able to use the keyboard of your PC (my software is a windows pc one). I can adapt easily what happens when yo click on a key. I use a bluetooth numeric keypad attached to my leg in rallies. I was thinking to use video, but it was not mandatory for me, and I did not yet. So when I will have adapt my softwares I will contact you, I we will see if I can help you or not.


----------



## Madmolecule

Submash said:


> Who else actually needs all those logs?


We don't really need them but they could be put to great use. As trips and routes become missions, having a system that turns this real time data into information will be mission critical, pun intended. I agree with your sentiment on how basic most of the race computers are. The biggest difference I see is that most of the existing systems are focused on the performance of the vehicle, future systems should also focus on the performance and experience for the driver and passengers. It could be used to enhance the driving experience, monitor the quality and performance of FSD, optimize charging. Even if it just provides the user with a recommended set points based on your driving history. The more we know about the car, and it knows about us, the better the experience will be. The cabin temperature setpoint recommendations could come from a combination of history, ambient weather conditions and current cabin temperature. And whether I would recommend turning on the seat heater or not. Most of us can live with that and the temperature in forgetting about it, but is that optimum. Thanks for putting the effort into this, I'm sure you'll love the canserver, it is a great product, I am looking very forward to your developments.


----------



## xilex

Hi guys, I followed CANserver development last year but not lately, and today I spotted this, and it reminded me of CANserver.

Look for "BMZX Tesla Model 3 Model Y Head Up Display Dual System HUD Instrument Panel Displayer" on Amazon, because those links don't seem to show up.






Apparently, it taps in directly into the computer in the dashboard area with something like the OBD splitter cables, (instead of the OBD/chassis port). It can pull all the same information as CANserver could, but is also able to intercept the right scroll wheel movements to adjust stuff on the HUD! Is it sending stuff back over the CAN?! I know we were concerned sending information back over the network improperly can potentially cause issues.


----------



## Roci

xilex said:


> It can pull all the same information as CANserver could, but is also able to intercept the right scroll wheel movements to adjust stuff on the HUD!


Just FYI, but I have a script a few pages back that does that on the CANServer.


----------



## JWardell

xilex said:


> Hi guys, I followed CANserver development last year but not lately, and today I spotted this, and it reminded me of CANserver.
> 
> Look for "BMZX Tesla Model 3 Model Y Head Up Display Dual System HUD Instrument Panel Displayer" on Amazon, because those links don't seem to show up.
> 
> 
> 
> 
> 
> 
> Apparently, it taps in directly into the computer in the dashboard area with something like the OBD splitter cables, (instead of the OBD/chassis port). It can pull all the same information as CANserver could, but is also able to intercept the right scroll wheel movements to adjust stuff on the HUD! Is it sending stuff back over the CAN?! I know we were concerned sending information back over the network improperly can potentially cause issues.


Yes, its just listening for their existing CAN signals (and they will still activate their functions on the car's display).
As Roci said, here is his post showing him achieving the same


----------



## thierryb

Hi Josh, I have just received my canserver with the one display and one additonal cable. 
May I start it with the microusb port just to test it and configure it outside the car ? 
Can you give me the references of the connector you use if I want to buy the other side one ?
I would like to start to adapt my rally software to get data from the canserver as I did with obd bluetooth device. I have understood that I have to use wifi instead of bluetooth. Can you explan me how to do it or give me pointer to people or projects that have already done it ?


----------



## Simono

Hello! Bought dual CAN version of Canserver. Can't make it working with any app. Scanmytesla(no wifi option), Teslax(wich port for panda?), SavvyCan(only linux? wich port?). Any instructions? It's own web server works ok.


----------



## JWardell

thierryb said:


> Hi Josh, I have just received my canserver with the one display and one additonal cable.
> May I start it with the microusb port just to test it and configure it outside the car ?
> Can you give me the references of the connector you use if I want to buy the other side one ?
> I would like to start to adapt my rally software to get data from the canserver as I did with obd bluetooth device. I have understood that I have to use wifi instead of bluetooth. Can you explan me how to do it or give me pointer to people or projects that have already done it ?


I see Chris is now helping you in Discord. I'm not sure which other side connector you are referring to. The bluetooth stack in the ESP32 is very large and will not fit with all the other software without removing most of the features, not to mention much much lower bandwidth.



Simono said:


> Hello! Bought dual CAN version of Canserver. Can't make it working with any app. Scanmytesla(no wifi option), Teslax(wich port for panda?), SavvyCan(only linux? wich port?). Any instructions? It's own web server works ok.


Oh, I wasn't aware there was a CANserver in Russia! I see what I think might be you, assuming you used a forwarder. Cool.
Scanmytesla requires a beta version from @amund7 at the moment, which you can get with testflight. Teslax should work on the panda tab, but you can just use the default 4.1 IP address and click the connect button at the bottom. SavvyCAN requires a special build and then you can connect to the IP address.
Now for the real question, does the Model 3 in Russia have the chassis connector under the seat?


----------



## thierryb

I Josh, Yes I solved my issue thanks to Chris. And evything is working right now, canserver and display. I just need my SR+ ;-)
You send me an additional small cable. Can you give me the reference of this male connector, and from the female one ?


----------



## JWardell

thierryb said:


> I Josh, Yes I solved my issue thanks to Chris. And evything is working right now, canserver and display. I just need my SR+ ;-)
> You send me an additional small cable. Can you give me the reference of this male connector, and from the female one ?


I sent an extra cable? I'm not sure which one.
Which connector are you asking about?
Maybe a picture will help


----------



## Simono

> Now for the real question, does the Model 3 in Russia have the chassis connector under the seat?


No. I can't find. But I've got usual Euro 2021 version. There's no official Tesla in Russia yet. Unfortunately.
So I connected it with OBD2 adapter harnesses. Still doesn't work with any app. Scanmytesla beta(Android), SavvyCan special, TESlax panda or wifi.


----------



## pyjamasam

Simono said:


> No. I can't find. But I've got usual Euro 2021 version. There's no official Tesla in Russia yet. Unfortunately.
> So I connected it with OBD2 adapter harnesses. Still doesn't work with any app...


Hmm.

When looking at the CANServer's status screen are you seeing any interface statistics? That will tell us if the CANServer is seeing can frames from the car, and this would be the first spot for us to check to make sure the connection to the car is working.

TesLax needs to use the Panda protocol with the correct IP (either the internal 192.168.4.1 when direct connected or the IP on the external network when connected). As for SavvyCAN you'll need to add the device as a CANServer and not a GVRET device. They use different protocols. The fork of SavvyCAN I made has code to deal with the protocol the CANServer uses.

If you want some more "real time" assistance (pending time zones  ) join us on our Discord - https://discord.gg/rMqBuTY9g4

Either way I'll keep trying to help you get things working.

chris.


----------



## Simono

Ok. Saavy CAN connects now, but then shows data only for 2-3 seconds and just close without any errors


----------



## pyjamasam

Simono said:


> View attachment 38255
> 
> 
> Ok. Saavy CAN connects now, but then shows data only for 2-3 seconds and just close without any errors


I had added the live stuff into SavvyCan as a quick hack. There might be some problems with it . But at least that tells us that things are working.

It looks like there is no traffic on the 2nd CAN interface (interface B). And you don't have the chassis connector for the 2nd bus. So I think what's going on is there is a bus id mismatch (this is a constant fight we have, but it all depends on wiring). So to correct this, on the settings screen change Interface A to be Bus 0 and then Interface B to Bus 1. Then TesLax and SMT should start to see data.

The Bus Ids help the apps sort out what things are connected to. But if they are miss-matched due to how things are wired physically then stuff doesn't show up right. We tried to pick a default that we hoped would work for most people, but it seems that it still isn't standard enough :-(. Hahahah

Make those changes and see what you get.

chris.


----------



## pyjamasam

Firmware v2.0.1 has just been released.

Some bug fixes and some improvements!

https://github.com/joshwardell/CANserver/releases/tag/2.0.1
chris.


----------



## JWardell

CANserver firmware version 2.0.1 was released today.
Most of you can just log into your Server with a web browser and click the Check for Update button on the home page, and it should find and install the new version.
This hopefully fixes some bus numbering issues and confusion, but my favorite new feature is Bonjour support, which means the phone apps can just "see" the canserver, and better yet your browser can just find it by going to http://canserver.local

More awesome work by @pyjamasam !


----------



## Seanyi

This might be a silly question, but Is there any way to get chassis bus CAN info on recent European models which has no chassis connector there?
I need desperately some info like speed limit sign.


----------



## JWardell

Seanyi said:


> This might be a silly question, but Is there any way to get chassis bus CAN info on recent European models which has no chassis connector there?
> I need desperately some info like speed limit sign.


I think there may be another access point at the TPMS receiver module, which is somewhere behind the rear seat. I may try to look for it soon.


----------



## Ren001

JWardell said:


> CANserver firmware version 2.0.1 was released today.
> Most of you can just log into your Server with a web browser and click the Check for Update button on the home page, and it should find and install the new version.
> This hopefully fixes some bus numbering issues and confusion, but my favorite new feature is Bonjour support, which means the phone apps can just "see" the canserver, and better yet your browser can just find it by going to http://canserver.local
> 
> More awesome work by @pyjamasam !


The update worked fine, thanks a lot!


----------



## Eugenius

JWardell said:


> Canserver firmware 2.0 is finally released!
> 
> Lots of great new features as highlighted in my last video, and solid reliability.
> 
> If your canserver was shipped in 2021, it already has a beta version of v2 on it and just needs upload of the firmware bins to the web interface.
> Earlier versions can either be USB flashed or follow a slightly more involved web interface upgrade...all instructions are in the Wiki.
> 
> https://github.com/joshwardell/CANserver/releases/tag/2.0.0


FW 2.0+ is no more open source, right?


----------



## pyjamasam

Eugenius said:


> FW 2.0+ is no more open source, right?


The code for v2+ isn't posted publicly, but we have a number of people all tinkering with the code in our discord community. I'd be glad to answer any questions you might have about the firmware.

chris.


----------



## Eugenius

pyjamasam said:


> The code for v2+ isn't posted publicly, but we have a number of people all tinkering with the code in our discord community. I'd be glad to answer any questions you might have about the firmware.
> 
> chris.


Is there a chance to extract panda server 2.0 part from it? Maybe you can post it as a external library?
I would like to use panda server for SMT in my own project.


----------



## All About Jake

My original Panda code for v1 is still available in the v1 branch: https://github.com/joshwardell/CANserver/blob/v1/CANserver/PandaUDP.cpp


----------



## Eugenius

All About Jake said:


> My original Panda code for v1 is still available in the v1 branch: https://github.com/joshwardell/CANserver/blob/v1/CANserver/PandaUDP.cpp


yeah, I know, thx!
but there no filters implemented, right? that's why I would use v2 for it, to use it faster...


----------



## pyjamasam

Eugenius said:


> yeah, I know, thx!
> but there no filters implemented, right? that's why I would use v2 for it, to use it faster...


I have documented the v2 extensions I made to the protocol here:
https://github.com/joshwardell/CANserver/wiki/PandaProtocol

That should be the info you are looking for. It has all the details about what bytes do what. (like setting up filters, and clearing etc).

Let me know if you have any questions.

chris.


----------



## Eugenius

pyjamasam said:


> I have documented the v2 extensions I made to the protocol here:
> https://github.com/joshwardell/CANserver/wiki/PandaProtocol
> 
> That should be the info you are looking for. It has all the details about what bytes do what. (like setting up filters, and clearing etc).
> 
> Let me know if you have any questions.
> 
> chris.


Why I'm asking:
I have an "adaptor" for Bluetooh SMT communction build with ESP32: https://github.com/Adminius/ESP32-ScanMyTesla
My next step was to do an "offline" logger like TeslaFI or TeslaLogger directly with ESP32 with logging to SD Card in the car and sync data to RasPi with DB and Grafana on it placed at home (maybe I will make integration direkt into TeslaLogger).
CANServer is actually perfect for it, but, CANServer doesn't support multiplexed messages yet :/
So, my Idea was to do my logger with at least panda server instead of slow Bluetooth part.
Is multiplexed message decoding planned? if yes, I will wait for it...


----------



## pyjamasam

Eugenius said:


> Why I'm asking:
> I have an "adaptor" for Bluetooh SMT communction build with ESP32: https://github.com/Adminius/ESP32-ScanMyTesla
> My next step was to do an "offline" logger like TeslaFI or TeslaLogger directly with ESP32 with logging to SD Card in the car and sync data to RasPi with DB and Grafana on it placed at home (maybe I will make integration direkt into TeslaLogger).
> CANServer is actually perfect for it, but, CANServer doesn't support multiplexed messages yet :/
> So, my Idea was to do my logger with at least panda server instead of slow Bluetooth part.
> Is multiplexed message decoding planned? if yes, I will wait for it...












The 2.1 beta build has full support for multiplexed CAN signals 

There is also some new webhook support in 2.1 that can be leveraged to auto trigger a log download when connecting to a wifi network. Makes automated log collection and download really nice now, and I think would work well in the use case you are trying to.

Also if you do direct to teslalogger (or teslamate) that would be amazing. Its one of the things we have been wanting for a while.

Jump on over to our discord and I can get you setup with a build to play with.

chris.


----------



## JWardell

Eugenius said:


> CANServer is actually perfect for it, but, CANServer doesn't support multiplexed messages yet :/


CANserver always logs and passes the entire message data to devices, so multiplexed messages have always worked for connected phone apps and log analysis. The multiplexing support (which as mentioned is coming soon) is strictly internal for easily adding signals into onboard lua processing scripts (ultimately for microdisplays), and is easily worked around with an if statement validating the signal with only the proper multiplexor value. I use it with my display for pack balancing for example.
But your intended use of auto processing logs will certainly work. Though I really would like to have some kind of universal method of auto-uploading logs to cloud services like TeslaFi, DIY Pi processing services, or just a home network NAS.


----------



## Eugenius

I'll not log whole CAN message (I can do it with my own implementation), I will log decoded value in "specials" format.

My idea is:

one csv file/trip. Each line contains position, Speed, Power and so on. Each line will be created by position change.
e.g.: UTC_TIME;LAT;LONG;SPEED;POWER;SoC...
with file name like utctime_trip.scv to have differentiation between different trips

after file is created and "offline-logger" has connection to TeslaLogger (or what ever server) it uploads this file.
TeslaLogger/Server reads line by line this file and saves it to internal db in its own format.

The same for charging-sessions and so on.

So I think this is possible with lua scripting.

for Upload we can use ESP32 FTP client like this: https://github.com/ldab/ESP32_FTPClient
There are also libs for DropBox and GDrive available, so you can be some where with internet connction and upload it to the cloud and not directly to RasPi.


----------



## JWardell

Ahhh I see, you want onboard decoding to intermittant csv file, which I can certainly see to be useful. I don't think we can do that though but I bet we can in the future. @pyjamasam


----------



## pyjamasam

JWardell said:


> Ahhh I see, you want onboard decoding to intermittant csv file, which I can certainly see to be useful. I don't think we can do that though but I bet we can in the future. @pyjamasam


Hmmm. A custom log file that you can write what ever you want to from LUA... That wouldn't be too bad to do. Let me noodle on that.

chris.


----------



## osunick

Hi all,

My wife and I are trying to do some development using the v2 protocol and we're seeing occasional extra bits inserted into the payload. Does panda remove the stuff bits in the CAN spec or do we have to do it client side? Thanks!


----------



## osunick

osunick said:


> Hi all,
> 
> My wife and I are trying to do some development using the v2 protocol and we're seeing occasional extra bits inserted into the payload. Does panda remove the stuff bits in the CAN spec or do we have to do it client side? Thanks!


OK, figured it out after playing with this DBC Editor Playground, turns out Java/Kotlin are not the best programs for doing bitwise operations, but we wrote some helper classes and have everything parsing correctly.


----------



## JWardell

osunick said:


> OK, figured it out after playing with this DBC Editor Playground, turns out Java/Kotlin are not the best programs for doing bitwise operations, but we wrote some helper classes and have everything parsing correctly.


OOoh, what an amazing spreadsheet!


----------



## osunick

So looks like blind spot monitoring only returns signal if the turn signal is engaged. Any ideas for other CAN signals that would represent rear left/right obstacle detection? I'd like to incorporate a live view of sorts.


----------



## Ren001

I am also very interested in blind spot motion without turn signal engaged - it would help a lot on the racing track....


----------



## osunick

I think these signals are interesting in 0x24A:
SG_ DAS_rearLeftVehDetectedTrip : 63|[email protected]+ (1,0) [0|1] "" Receiver
SG_ DAS_rearRightVehDetectedTrip : 62|[email protected]+ (1,0) [0|1] "" Receiver

I'll experiment once the kids are asleep and I can borrow my wife's dev environment again.


----------



## osunick

osunick said:


> I think these signals are interesting in 0x24A:
> SG_ DAS_rearLeftVehDetectedTrip : 63|[email protected]+ (1,0) [0|1] "" Receiver
> SG_ DAS_rearRightVehDetectedTrip : 62|[email protected]+ (1,0) [0|1] "" Receiver
> 
> I'll experiment once the kids are asleep and I can borrow my wife's dev environment again.


No joy. I'll keep looking.


----------



## osunick

Next up are these:
BO_ 558 PARK_sdiRear: 8 ETH
SG_ PARK_sdiRearChecksum: 56|[email protected]+ (1,0) [0|0] "" X
SG_ PARK_sdiRearCounter: 54|[email protected]+ (1,0) [0|0] "" X
SG_ PARK_sdiSensor10RawDistData: 27|[email protected]+ (1,0) [0|0] "cm" X
SG_ PARK_sdiSensor11RawDistData: 36|[email protected]+ (1,0) [0|0] "cm" X
SG_ PARK_sdiSensor12RawDistData: 45|[email protected]+ (1,0) [0|0] "cm" X
SG_ PARK_sdiSensor7RawDistData: 0|[email protected]+ (1,0) [0|0] "cm" X
SG_ PARK_sdiSensor8RawDistData: 9|[email protected]+ (1,0) [0|0] "cm" X
SG_ PARK_sdiSensor9RawDistData: 18|[email protected]+ (1,0) [0|0] "cm" X

I guess I'll go out tomorrow and stand around the car to figure out which sensors map to where on the bumper. Anyone know? 9 bits of data so I assume max is somewhere between 256 and 512 cm, which maps well to my understanding that the ultrasonics have about 15ft of range.


----------



## osunick

Figured it out. Sensors 7-12 are clockwise from the right facing ultrasonic sensor in the rear bumper. Returns a raw value of distance in cm, up to 500. Readings of 500 are rare and I assume are treated like infinite distance, 372 appears to be the highest I generally see. I have pretty decent obstacle highlighting in my app now, will make a video and share later. The data is very jittery so smoothing it may be helpful, I had to blend data from the right and right corner sensors to get a reasonable BSM looking highlight.


----------



## JWardell

Yes, as far as I know, you can get raw park sensor data, or the blind spot collision warning, but nothing in between, because tesla doesn't bother to calculate such a thing as everyone else's BSWs


----------



## Ren001

Wow, that's an improvement! Well done!
Is the data from the sensors only present at low speeds (i.e. parking) or always?


----------



## osunick

Ren001 said:


> Wow, that's an improvement! Well done!
> Is the data from the sensors only present at low speeds (i.e. parking) or always?


Always. I'm having issues decoding multiplexed data, for instance I want frunk status:
SG_ VCFRONT_frunkLatchStatus m0 : 3|[email protected]+ (1,0) [0|8] "" Receiver

if I decode this panda returns alternating values, I assume for the different m values. Tips on how to decode?


----------



## osunick

Here's a recording of the dash in action:


----------



## osunick

I can use some help here.

Here is the signal I want:
SG_ VCFRONT_frunkLatchStatus m0 : 3|[email protected]+ (1,0) [0|8] "" Receiver

and here is the definition for this frame:
BO_ 737 ID2E1VCFRONT_status: 8 VehicleBus
SG_ VCFRONT_statusIndex M : 0|[email protected]+ (1,0) [0|6] "" Receiver

When I extract raw data from Panda, in the payload I expect the first three digits to be the mux value from 0-6 in binary. This is an example of what I'm getting:

2021-11-04 09:41:44.593 8017-8044/tesladashboard D/PandaServiceImpl: frunkState mux startbit:3 bitlength:4 serviceIndex:3
2021-11-04 09:41:44.593 8017-8044/tesladashboard D/PandaFrame: muxValue: 0 GVSMUXPayload: 0000010100100110000000000000000000000000000000000000000000000000 unparsedMux000result 0
2021-11-04 09:41:44.610 8017-8044/tesladashboard D/PandaServiceImpl: frunkState mux startbit:3 bitlength:4 serviceIndex:3
2021-11-04 09:41:44.610 8017-8044/tesladashboard D/PandaFrame: muxValue: 0 GVSMUXPayload: 0000100000100001000001000010000010100010100011110010001000001000 unparsedMux000result 1

so my understanding here is that since both frames start with 000 they are the correct frame to process, but now I"m seeing cycling between two values. (when I look at other frames returned with this frameid, i will see payloads starting with 111 (7) which should be invalid as the highest valid value for statusIndex is 6.

I am new to all of this so my assumption is I'm making a basic mistake but I'm not sure what is going on here.


----------



## osunick

Never mind, figured it out. I have to read the first byte in and index backwards from the last digit because this is intended to be interpreted as hex.


----------



## osunick

Occasionally, my CANServer won't come up and I have to bounce the power. Anyone know why or if there's anything I can do to make it more reliable?


----------



## JWardell

osunick said:


> Occasionally, my CANServer won't come up and I have to bounce the power. Anyone know why or if there's anything I can do to make it more reliable?


Is it powered under the seat or just behind the rear console?


----------



## osunick

JWardell said:


> Is it powered under the seat or just behind the rear console?


Under the seat. When it fails it is lit up, just red.


----------



## osunick

If anyone is interested in trying out an apk from the dashboard project, let me know. All you need is a CANServer and for your phone to be connected to its wifi. I need to clean some things up but intent is to publish with a permissive open source license that also requires downstream branches/forks to be open source.


----------



## Ren001

osunick said:


> Here's a recording of the dash in action:


So when this is working up to distances of 3 meters is there a way this part of code can be used to show the left/right arrows on the microdisplay (instead of the "useless" code at the moment)?



Code:


 -- Left and Right Blindspot Arrow Overlay
    -- Sets Left Blindspot Arrow Overlay Variable
        local bsl = CANServer_getAnalysisVar("BSL");
        local bld = 0;
        local r0time = 100;
    -- Sets Right Blindspot Arrow Overlay Variable     
        local bsr = CANServer_getAnalysisVar("BSR");
        local brd = 0;
        local r1time = 100;

-- Value of 1 will Display Left Arrow Ovlerlay
    if (bsl == l or bsl == 2) then
           bld = 1;
            r0time = 800;
    end
-- Value of 2 will Display Right Arrow Ovlerlay
        if (bsr == l or bsr == 2) then
            brd = 2;
           r1time = 800;
    end
-- If bld value > 0 display the Left Blindspot overlay on Display 0
    if (bld > 0) then
        CANServer_setDisplayString(0, bld .. "v63488c6m1000r")
    end
-- If brd value > 0 display the Right Blindspot overlay on Display 1
    if (brd > 0) then
        CANServer_setDisplayString(1, brd .. "v63488c6m1000r")
    end

Any help appreciated!


----------



## JWardell

Ren001 said:


> So when this is working up to distances of 3 meters is there a way this part of code can be used to show the left/right arrows on the microdisplay (instead of the "useless" code at the moment)?
> 
> 
> 
> Code:
> 
> 
> -- Left and Right Blindspot Arrow Overlay
> -- Sets Left Blindspot Arrow Overlay Variable
> local bsl = CANServer_getAnalysisVar("BSL");
> local bld = 0;
> local r0time = 100;
> -- Sets Right Blindspot Arrow Overlay Variable
> local bsr = CANServer_getAnalysisVar("BSR");
> local brd = 0;
> local r1time = 100;
> 
> -- Value of 1 will Display Left Arrow Ovlerlay
> if (bsl == l or bsl == 2) then
> bld = 1;
> r0time = 800;
> end
> -- Value of 2 will Display Right Arrow Ovlerlay
> if (bsr == l or bsr == 2) then
> brd = 2;
> r1time = 800;
> end
> -- If bld value > 0 display the Left Blindspot overlay on Display 0
> if (bld > 0) then
> CANServer_setDisplayString(0, bld .. "v63488c6m1000r")
> end
> -- If brd value > 0 display the Right Blindspot overlay on Display 1
> if (brd > 0) then
> CANServer_setDisplayString(1, brd .. "v63488c6m1000r")
> end
> 
> Any help appreciated!


I think his code uses the same values


----------



## Ren001

My impression is there is obstacle detection without the blinker being engaged, so I thought the detection is independent of the blinker stage and thus can be used on track.


----------



## osunick

Hi all, if you want to test, here's an


Ren001 said:


> My impression is there is obstacle detection without the blinker being engaged, so I thought the detection is independent of the blinker stage and thus can be used on track.


Yep, I take the inputs from the outermost two sensors on the rear bumper and OR them so if there's an obstacle on the side that is < 3m it will trigger a level 1 warning and < 2m is level 2. playing with making this speed or road sensitive. Here's a video with the latest, I have a power meter now that shows kW or hp with resettable max indicators on the left and right.


----------



## iChris93

What is battTempPct and is it still decoded correctly? Min I’ve seen is 50% with a max of 63.6%

ETA: okay I’ve now seen it below 50%, but there is a wide temperate range where it is at 50%.


----------



## pyrlix

osunick said:


> Hi all, if you want to test, here's an
> 
> Yep, I take the inputs from the outermost two sensors on the rear bumper and OR them so if there's an obstacle on the side that is < 3m it will trigger a level 1 warning and < 2m is level 2. playing with making this speed or road sensitive. Here's a video with the latest, I have a power meter now that shows kW or hp with resettable max indicators on the left and right.


This looks quite interesting.
Currently i have a Hansshow Display in my M3LR but i dont quite like the UI of it. Yours looks very close to the Style of the Model3 and way more fitting
Is your APK or Source somehow available?

Would love to try it out if it can do KPH aswell


----------



## osunick

pyrlix said:


> This looks quite interesting.
> Currently i have a Hansshow Display in my M3LR but i dont quite like the UI of it. Yours looks very close to the Style of the Model3 and way more fitting
> Is your APK or Source somehow available?
> 
> Would love to try it out if it can do KPH aswell


Yes! I implemented KPH it should just match the vehicle UI preferences. I didn't love the hansshow and this display also plays nicely with split screen in Android so you can run Google Maps or any navigation app in one half of the display.

Get started here


----------



## JWardell

osunick said:


> Yes! I implemented KPH it should just match the vehicle UI preferences. I didn't love the hansshow and this display also plays nicely with split screen in Android so you can run Google Maps or any navigation app in one half of the display.
> 
> Get started here


OK now I really need to get it running, considering I almost always have waze running. Didn't think about split screen


----------



## osunick

JWardell said:


> OK now I really need to get it running, considering I almost always have waze running. Didn't think about split screen


Google Maps here but you get the idea.


----------



## pyrlix

Wondering, any chance you can fit exterior temperature and battery temperature on the gauge in a meaningful way? 
Battery temp would be nice to see in the bottom bar? Also maybe, just as an idea, instead of having minium and maximum charge/discharge rate to have an actual
front/rear engine power use?


----------



## osunick

pyrlix said:


> Wondering, any chance you can fit exterior temperature and battery temperature on the gauge in a meaningful way?
> Battery temp would be nice to see in the bottom bar? Also maybe, just as an idea, instead of having minium and maximum charge/discharge rate to have an actual
> front/rear engine power use?


All of that is possible and even something I'm planning on doing but I want to keep doing some refactoring. I started this knowing zero Android or Kotlin so now I'm at the inevitable point where I have to fix all the mistakes my dumber past self made.


----------



## shovonmshahriar

TesLAX isn't showing anything in the iOS. I've reset and reconnected everything and redownloaded the profile in the app. CANServer is connected via the OBDII port and https page is getting all the signals just fine. Help!


----------



## pyrlix

Using the CANDash for a few days now i noticed a few quirks... might be down to the code though.

The Speedo is slow at times while the actual power use is on-time. Most features don't work on mine, might be due to me using the vehicle bus, as my 2021 MiC Model 3 has no chassis bus connector at all. So no current speed limit, no AP vis, no blind spot. 

However it feels so much more OEM than SMTs Dashboard or the Hansshow visualisation for now.


----------



## JWardell

shovonmshahriar said:


> View attachment 40770
> TesLAX isn't showing anything in the iOS. I've reset and reconnected everything and redownloaded the profile in the app. CANServer is connected via the OBDII port and https page is getting all the signals just fine. Help!


31 messages per second means it's not getting the data it wants. You might need to swap your can busses again, in the app or on the server


----------



## pyjamasam

Firmware v2.1.0 has just been released.

https://github.com/joshwardell/CANserver/releases/tag/2.1.0
Bunch of new features, and of course squishing bugs and optimizing performance

chris.


----------



## Ren001

pyjamasam said:


> Firmware v2.1.0 has just been released.


Well done! With this version canDASH is working for me too (european M3P)!

@osunick Is there a way to switch the text _mph_ to _km/h_ ? At least I did not find a way - everything else on the display is independent of units...

Thank you both for your ongoing efforts!

Edit: Running Android 10 Kernel 4.9.118 Patch Level Nov. 2021 on Galaxy S9


----------



## osunick

Ren001 said:


> Well done! With this version canDASH is working for me too (european M3P)!
> 
> @osunick Is there a way to switch the text _mph_ to _km/h_ ? At least In did not find a way - everything else on the display is independent of units...
> 
> Thank you both for your ongoing efforts!


It should match the vehicle display, so if it isn't doing this automatically, it's a bug. I'll do some testing today. Also, anyone using CAN Dash, if you can self report device and OS version it would be useful for me to know what works. I've tested from 6.0.1 to 11. Works on 12 also but there's a split screen bug that makes layout a little off.


----------



## osunick

pyrlix said:


> Using the CANDash for a few days now i noticed a few quirks... might be down to the code though.
> 
> The Speedo is slow at times while the actual power use is on-time. Most features don't work on mine, might be due to me using the vehicle bus, as my 2021 MiC Model 3 has no chassis bus connector at all. So no current speed limit, no AP vis, no blind spot.
> 
> However it feels so much more OEM than SMTs Dashboard or the Hansshow visualisation for now.


Yep, I fixed the speedo issue, turns out I didn't rtfm and was throwing out data. Try again and if you can share results I'd appreciate it, along with the hardware you're testing with.

If you don't have Chassis bus you will lose anything related to AP, unfortunately.


----------



## osunick

KPH is now fixed. The speed was showing correctly but my code for changing the label was in the wrong place.


----------



## osunick

FYI- you may notice a shift in the fonts for the most recent releases. Tesla abandoned Gotham (I presume for licensing reasons) so using my open font lookalike (montserrat) didn't make sense. Since I couldn't find a good copy of what v11 is using, and the font is a mess anyway, I settled on Inter, which is optimized for display and is a fantastic font at all sizes. I am shifting a bit stylistically to be more sleek and modern than Tesla's UI, with a design that is inspired by print as much as it is by display, since a smartphone display now has higher resolution than print and the contrast to match. Think what a NASA engineer in the 60s would be doing with transparencies and an x-acto, or those obviously too sharp for display tech of the time 80s concept cars, and you get the idea.

You can see responsiveness is greatly improved in this raw video:






It might be too crowded for some and I will get around to providing options to hide UI as needed, or just let someone else contribute that code!

-n.


----------



## osunick

pyrlix said:


> Using the CANDash for a few days now i noticed a few quirks... might be down to the code though.
> 
> The Speedo is slow at times while the actual power use is on-time. Most features don't work on mine, might be due to me using the vehicle bus, as my 2021 MiC Model 3 has no chassis bus connector at all. So no current speed limit, no AP vis, no blind spot.
> 
> However it feels so much more OEM than SMTs Dashboard or the Hansshow visualisation for now.


I actually don't have speed limit display right now. I can do actual speed limit if there is demand, but would probably do the euro style red outlined white circle than the US style speed limit rectangle, for space utilization. Autopilot set speed does not appear to be able anywhere, sadly. I don't think Hansshow has even figured it out.


----------



## osunick

I meant to share this but forgot. I scanned the upper console trim and designed a mount for a Pixel 2XL. It'll go up on thingiverse soon. The idea is you take your existing trim (or a replacement from eBay/tesla) and directly mount this with screws. I have designed a small jig to make the drilling easier and it's pretty forgiving. With tasker and ADB I have it working well enough where I don't have to touch it. If the phone happens to run out of power, it powers up with the car and launches the dash/hotspot when it's done booting. I am using a hotspot because I am running a SIM in this device so I can do split screen google maps/abrp/podcasts/waze.


----------



## Ren001

osunick said:


> if you can self report device and OS version it would be useful for me to know what works


Android 7.0, Kernel 4.1.18 Nov. 2018 on Huawei Mediapad 7"
The app is working, but has no dedicated icon (default installer icon is taken and displayed)

Android 10 Kernel 4.9.118 Patch Level Nov. 2021 on Galaxy S9 - everything is working perfect!

Do I need the chassis bus for collision warning info?
I have no chassis bus connector under the seat (european M3P) and I have a CANServer Rel.1, so I am not getting the nice red lines to show objects near the sides of the car.
All other infos are displayed perfect, speedo is very responsive!


----------



## osunick

Ren001 said:


> Android 7.0, Kernel 4.1.18 Nov. 2018 on Huawei Mediapad 7"
> The app is working, but has no dedicated icon (default installer icon is taken and displayed)
> 
> Android 10 Kernel 4.9.118 Patch Level Nov. 2021 on Galaxy S9 - everything is working perfect!
> 
> Do I need the chassis bus for collision warning info?
> I have no chassis bus connector under the seat (european M3P) and I have a CANServer Rel.1, so I am not getting the nice red lines to show objects near the sides of the car.
> All other infos are displayed perfect, speedo is very responsive!


Yep, unfortunately all that data is only on the Chassis bus. I will work on the icon later, as you can imagine I had some other things to sort out first!


----------



## pyrlix

osunick said:


> FYI- you may notice a shift in the fonts for the most recent releases. Tesla abandoned Gotham (I presume for licensing reasons) so using my open font lookalike (montserrat) didn't make sense. Since I couldn't find a good copy of what v11 is using, and the font is a mess anyway, I settled on Inter, which is optimized for display and is a fantastic font at all sizes. I am shifting a bit stylistically to be more sleek and modern than Tesla's UI, with a design that is inspired by print as much as it is by display, since a smartphone display now has higher resolution than print and the contrast to match. Think what a NASA engineer in the 60s would be doing with transparencies and an x-acto, or those obviously too sharp for display tech of the time 80s concept cars, and you get the idea.
> 
> You can see responsiveness is greatly improved in this raw video:
> 
> 
> 
> 
> 
> 
> It might be too crowded for some and I will get around to providing options to hide UI as needed, or just let someone else contribute that code!
> 
> -n.


Looks gorgeous. Have you updated the APK in this google docs thing?

What i would rather see instead of Torques is Engine Power, but that is nitpicking 
As for the font: Try Proxima Nova... it should be the exact font that also Tesla uses.


----------



## osunick

pyrlix said:


> Looks gorgeous. Have you updated the APK in this google docs thing?
> 
> What i would rather see instead of Torques is Engine Power, but that is nitpicking
> As for the font: Try Proxima Nova... it should be the exact font that also Tesla uses.


Unfortunately, I can't use any licensed fonts in this project as the goal is open source, not a closed source paid app, but that's a great tip and I will look for similar open source alternatives.

I used torque because it's what the motors report directly and is more relevant for track driving than hp.

I do try to update the apk daily so it's always worth reinstalling to see what's new. Now that I store preferences there's no downside to updating, for the most part.


----------



## osunick

pyrlix said:


> Looks gorgeous. Have you updated the APK in this google docs thing?
> 
> What i would rather see instead of Torques is Engine Power, but that is nitpicking
> As for the font: Try Proxima Nova... it should be the exact font that also Tesla uses.


I looked again, it is close but not Proxima Nova. That may be what the stylesheets say on the web and what Tesla is using for web text but if you look closely at the 'R' glyph on the shifter display in the car, PN uses a straight leg and the leg on whatever Tesla is using is curved. I would be very surprised if the font is one Tesla has to pay a license for, my guess would be either an open font or one Tesla commissioned.


----------



## Ren001

osunick said:


> I used torque because it's what the motors report directly and is more relevant for track driving than hp.


I totally agree! 
Any chance to display also front brake temperature? Rears won't overheat, but fronts are critical on some tracks...


----------



## osunick

Ren001 said:


> I totally agree!
> Any chance to display also front brake temperature? Rears won't overheat, but fronts are critical on some tracks...


Yes,.there is. The car estimates it and apparently does a good job, just need to figure out where to put it.


----------



## osunick

Ren001 said:


> Android 7.0, Kernel 4.1.18 Nov. 2018 on Huawei Mediapad 7"
> The app is working, but has no dedicated icon (default installer icon is taken and displayed)
> 
> Android 10 Kernel 4.9.118 Patch Level Nov. 2021 on Galaxy S9 - everything is working perfect!
> 
> Do I need the chassis bus for collision warning info?
> I have no chassis bus connector under the seat (european M3P) and I have a CANServer Rel.1, so I am not getting the nice red lines to show objects near the sides of the car.
> All other infos are displayed perfect, speedo is very responsive!


so i looked at my signal spec and you should get the proximity warnings for the sides of the car as the ultrasonic sensors are on the Vehicle Bus with speed and everything else. I wonder what's going on there. EDIT: This data is on both buses, I will fix and rebuild, should be updated in the doc shortly.


----------



## Ren001

osunick said:


> I will fix and rebuild,


Hey, cool! I just bought a dedicated Galaxy S9 to act as a display for your app - very much appreciated what you are doing!
As I am in touch with Ben Schaffer of Unplugged Performance (organizing Tesla Corsa events in Europe) your work will be showcased on track.


----------



## osunick

osunick said:


> so i looked at my signal spec and you should get the proximity warnings for the sides of the car as the ultrasonic sensors are on the Vehicle Bus with speed and everything else. I wonder what's going on there.





Ren001 said:


> Hey, cool! I just bought a dedicated Galaxy S9 to act as a display for your app - very much appreciated what you are doing!
> As I am in touch with Ben Schaffer of Unplugged Performance (organizing Tesla Corsa events in Europe) your work will be showcased on track.


AWESOME! I have a custom mount I designed for the Pixel 2 XL, shouldn't be too hard to adapt to an S9. Let me know if there's anything else you need- working on getting this published to the play store (as a prerequiste to getting it open sourced) soon, but I'll get the design up on Thingiverse ASAP.


----------



## Ren001

osunick said:


> AWESOME! I have a custom mount I designed for the Pixel 2 XL, shouldn't be too hard to adapt to an S9. Let me know if there's anything else you need- working on getting this published to the play store (as a prerequiste to getting it open sourced) soon, but I'll get the design up on Thingiverse ASAP.


Your mount looks great! My solution of mounting is much simpler:
I just attached the S9 with adhesive tape to a brodit clip (designed specially for the model 3)


----------



## osunick

Ren001 said:


> Your mount looks great! My solution of mouning is much simpler:
> I just attached the S9 with adhesive tape on a brodit clip (designed specially for the model 3)
> View attachment 41024


Yep I have one of those too (we get them at proclipusa.com, which is the brodit reseller here). When I get some spare time I'll look at implementing brake temps. Someone who knows what they're talking about has advised me to just show max front brake temp and max rear brake temp as they tend to be similar left to right.


----------



## JWardell

Ren001 said:


> I am in touch with Ben Schaffer of Unplugged Performance (organizing Tesla Corsa events in Europe) your work will be showcased on track.


 Please do!!


----------



## osunick

Ren001 said:


> Your mount looks great! My solution of mounting is much simpler:
> I just attached the S9 with adhesive tape to a brodit clip (designed specially for the model 3)
> View attachment 41024


I have good news and bad news. Good news is that I added brake temps, based on the advice of someone who should know, the best thing is to show the max brake temp for the front and rear axles, as they are unlikely to deviate much from each other, even on track. Bad news is that the blind spot monitoring doesn't work on the Vehicle Bus. Either Tesla changed something or the DBC is wrong, so you won't get blind spot/obstacle monitoring.


----------



## Ren001

osunick said:


> Good news is that I added brake temps,


and they are working!

I am currently struggling with automatted power on the Galaxy S9 as soon as I open the cars door.

Your hint with _fastboot oem off-mode-charge 0 _does not seem to work with android 11 and a non routed device.

And I had the problem of being able to connect only one device via bluetooth with the Tesla, so in tasker I cannot use the state "bluetooth connected" to the Tesla for the S9 display to start CanDASH as this connection is already used for my phone.
Seems to work with "BT near"...


----------



## Aden

@JWardell I found your YouTube channel last night and binged a bunch of your videos. I really like the videos where you walk through the various readings (I use ScanMyTesla) and describe what they mean. I subbed to your channel, and look forward to more content. :thumbsup:


----------



## osunick

Ren001 said:


> and they are working!
> 
> I am currently struggling with automatted power on the Galaxy S9 as soon as I open the cars door.
> 
> Your hint with _fastboot oem off-mode-charge 0 _does not seem to work with android 11 and a non routed device.
> 
> And I had the problem of being able to connect only one device via bluetooth with the Tesla, so in tasker I cannot use the state "bluetooth connected" to the Tesla for the S9 display to start CanDASH as this connection is already used for my phone.
> Seems to work with "BT near"...


I'm using "power connected" in Tasker, since the phone I'm using is only really used for the CANdash, and this event launches the app and starts the wifi hotspot. From my very short time googling, it looks like the fastboot trick works on most Android phones EXCEPT Samsung, even with a locked bootloader. Sorry for that- plan is to put a wiki in the GitHub repo with a list of phones that are known to work well. I've been focused on Nexus/Pixel devices, but was able to get things working well on my older Xperia Z3, which I like because it has a side mount power port.


----------



## pyrlix

So i was testing the most recent version of the CANdash and i found a few issues. Might be down to my specific use case or some weird things.
My current connection setup is:
CANServer -> HomeWiFi when the vehicle is standing, once it should be out of range it should connect to the WiFi of the Hansshow Hotspot. Alternatively the Hansshow Display can connect to the CANServer, i dont think there is any difference to it.

Once the hansshow display finishes booting it fires up the CANDash with Tasker. What i noticed is this: If using the Display/Phone in Hotspot mode i always need to rescan and start the CANDash for some reason. However its also true when i connect the display/phone to the CANServer.
In the older versions CANDash somehow connected automatically and now it does not, or am i doing something wrong?

Scaling is bonkers on my screen. I bet this is down to me using a mega-widescreen with a relatively low resolution.









I also lack some parameters, must be down to using the vehicle bus and those parameters laying on different adresses. 
However once the github is up i will opt for current consumption,motor power and battery voltage. Outside temperature would also be nice...

I use the implementation more as an additional information panel aswell as a dashboard replacement, i require less of the track-related things due to this.


----------



## osunick

pyrlix said:


> So i was testing the most recent version of the CANdash and i found a few issues. Might be down to my specific use case or some weird things.
> My current connection setup is:
> CANServer -> HomeWiFi when the vehicle is standing, once it should be out of range it should connect to the WiFi of the Hansshow Hotspot. Alternatively the Hansshow Display can connect to the CANServer, i dont think there is any difference to it.
> 
> Once the hansshow display finishes booting it fires up the CANDash with Tasker. What i noticed is this: If using the Display/Phone in Hotspot mode i always need to rescan and start the CANDash for some reason. However its also true when i connect the display/phone to the CANServer.
> In the older versions CANDash somehow connected automatically and now it does not, or am i doing something wrong?
> 
> Scaling is bonkers on my screen. I bet this is down to me using a mega-widescreen with a relatively low resolution.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I also lack some parameters, must be down to using the vehicle bus and those parameters laying on different adresses.
> However once the github is up i will opt for current consumption,motor power and battery voltage. Outside temperature would also be nice...
> 
> I use the implementation more as an additional information panel aswell as a dashboard replacement, i require less of the track-related things due to this.


Oh that neat that this even works on the Hansshow display, any idea what version of Android it runs? I would be surprised that the CANServer is on the same IP address on your home network and your hotspot, which would explain the need to scan when the network changes.


pyrlix said:


> So i was testing the most recent version of the CANdash and i found a few issues. Might be down to my specific use case or some weird things.
> My current connection setup is:
> CANServer -> HomeWiFi when the vehicle is standing, once it should be out of range it should connect to the WiFi of the Hansshow Hotspot. Alternatively the Hansshow Display can connect to the CANServer, i dont think there is any difference to it.
> 
> Once the hansshow display finishes booting it fires up the CANDash with Tasker. What i noticed is this: If using the Display/Phone in Hotspot mode i always need to rescan and start the CANDash for some reason. However its also true when i connect the display/phone to the CANServer.
> In the older versions CANDash somehow connected automatically and now it does not, or am i doing something wrong?
> 
> Scaling is bonkers on my screen. I bet this is down to me using a mega-widescreen with a relatively low resolution.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I also lack some parameters, must be down to using the vehicle bus and those parameters laying on different adresses.
> However once the github is up i will opt for current consumption,motor power and battery voltage. Outside temperature would also be nice...
> 
> I use the implementation more as an additional information panel aswell as a dashboard replacement, i require less of the track-related things due to this.


All my layout is set up to be relative and auto sizing so I'm surprised to see these layout issues. Also, I wonder if I can access the native hansshow CAN interface somehow. I will work on making the auxilliary gauges hideable in a future release. Right now I'm wrestling with Google Play to get this staged for broader testing before I open up the repo.

Finally- the hansshow also does not show autopilot max speed, right? I know it can show speed limit but AFAIK none of the display devices can see MAX speed as it's on the bus that the canserver cannot see.


----------



## osunick

pyrlix said:


> So i was testing the most recent version of the CANdash and i found a few issues. Might be down to my specific use case or some weird things.
> My current connection setup is:
> CANServer -> HomeWiFi when the vehicle is standing, once it should be out of range it should connect to the WiFi of the Hansshow Hotspot. Alternatively the Hansshow Display can connect to the CANServer, i dont think there is any difference to it.
> 
> Once the hansshow display finishes booting it fires up the CANDash with Tasker. What i noticed is this: If using the Display/Phone in Hotspot mode i always need to rescan and start the CANDash for some reason. However its also true when i connect the display/phone to the CANServer.
> In the older versions CANDash somehow connected automatically and now it does not, or am i doing something wrong?
> 
> Scaling is bonkers on my screen. I bet this is down to me using a mega-widescreen with a relatively low resolution.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I also lack some parameters, must be down to using the vehicle bus and those parameters laying on different adresses.
> However once the github is up i will opt for current consumption,motor power and battery voltage. Outside temperature would also be nice...
> 
> I use the implementation more as an additional information panel aswell as a dashboard replacement, i require less of the track-related things due to this.





pyrlix said:


> So i was testing the most recent version of the CANdash and i found a few issues. Might be down to my specific use case or some weird things.
> My current connection setup is:
> CANServer -> HomeWiFi when the vehicle is standing, once it should be out of range it should connect to the WiFi of the Hansshow Hotspot. Alternatively the Hansshow Display can connect to the CANServer, i dont think there is any difference to it.
> 
> Once the hansshow display finishes booting it fires up the CANDash with Tasker. What i noticed is this: If using the Display/Phone in Hotspot mode i always need to rescan and start the CANDash for some reason. However its also true when i connect the display/phone to the CANServer.
> In the older versions CANDash somehow connected automatically and now it does not, or am i doing something wrong?
> 
> Scaling is bonkers on my screen. I bet this is down to me using a mega-widescreen with a relatively low resolution.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I also lack some parameters, must be down to using the vehicle bus and those parameters laying on different adresses.
> However once the github is up i will opt for current consumption,motor power and battery voltage. Outside temperature would also be nice...
> 
> I use the implementation more as an additional information panel aswell as a dashboard replacement, i require less of the track-related things due to this.


I talked to some folks and the consensus seems to be that hanssshow is doing something non standard with dpi and text scaling. If there's an android style settings page can you see if you set things to 100% or if they are at 100, try smaller?


----------



## JWardell

osunick said:


> I have good news and bad news. Good news is that I added brake temps, based on the advice of someone who should know, the best thing is to show the max brake temp for the front and rear axles, as they are unlikely to deviate much from each other, even on track. Bad news is that the blind spot monitoring doesn't work on the Vehicle Bus. Either Tesla changed something or the DBC is wrong, so you won't get blind spot/obstacle monitoring.


AFAIK blind spot alerts were always chassis only. I would never use the term "working" to describe them.
I think the better way is to use the rear corner parking sensors, need to experiment with that a bit more



Aden said:


> @JWardell I found your YouTube channel last night and binged a bunch of your videos. I really like the videos where you walk through the various readings (I use ScanMyTesla) and describe what they mean. I subbed to your channel, and look forward to more content. :thumbsup:


Thanks!


----------



## osunick

JWardell said:


> AFAIK blind spot alerts were always chassis only. I would never use the term "working" to describe them.
> I think the better way is to use the rear corner parking sensors, need to experiment with that a bit more
> 
> Thanks!


Yeah I really just meant both the blind spot and parking sensor based obstacle monitoring require the chassis bus, but the DBC shows the parking sensors on the vehicle bus, which seems to not be correct anymore. The blind spot signals are limited in the sense that they seem to only be triggered when a turn signal is on or if you're actively in the process of crashing into someone, but provide no passive updates on ambient traffic, which is why I use parking sensors for the live detection.


----------



## pyrlix

osunick said:


> Oh that neat that this even works on the Hansshow display, any idea what version of Android it runs? I would be surprised that the CANServer is on the same IP address on your home network and your hotspot, which would explain the need to scan when the network changes.


That might explain it... so its back to the good old HansShow -> CANSever HotSpot connection path, although that one seems to be spotty.
The Hans Display is running Android 9 64bit on a Mediatek MT2712. The spec page says it a 8" 1900x800 screen, CPU-Z (i will check with AIDA at some point) tells me its a 10" Screen with 1280x480 at 133dpi.


osunick said:


> Also, I wonder if I can access the native hansshow CAN interface somehow


Good question. I can pass you the launcher and systemui apk if its of any help.



osunick said:


> I talked to some folks and the consensus seems to be that hanssshow is doing something non standard with dpi and text scaling. If there's an android style settings page can you see if you set things to 100% or if they are at 100, try smaller?


Need to see if it has that. Really hard to find anything since hansshow hid the setting quite clever. The UI with the Dials you can see is basically the launcher.


osunick said:


> Finally- the hansshow also does not show autopilot max speed, right? I know it can show speed limit but AFAIK none of the display devices can see MAX speed as it's on the bus that the canserver cannot see.


It can report the current speed limit, the fact that autopilot is going, that i need to touch the steering wheel. Reports light status, TPMS values. This to me indicates the use of the Chassis Bus.


----------



## osunick

480px height makes sense since that's what Carplay and Android Auto like.


----------



## osunick

pyrlix said:


> That might explain it... so its back to the good old HansShow -> CANSever HotSpot connection path, although that one seems to be spotty.
> The Hans Display is running Android 9 64bit on a Mediatek MT2712. The spec page says it a 8" 1900x800 screen, CPU-Z (i will check with AIDA at some point) tells me its a 10" Screen with 1280x480 at 133dpi.
> 
> Good question. I can pass you the launcher and systemui apk if its of any help.
> 
> Need to see if it has that. Really hard to find anything since hansshow hid the setting quite clever. The UI with the Dials you can see is basically the launcher.
> 
> It can report the current speed limit, the fact that autopilot is going, that i need to touch the steering wheel. Reports light status, TPMS values. This to me indicates the use of the Chassis Bus.


OK, I think I have fixed the font sizes to be independent of any OS level preference. Can you try installing the latest apk from the gdoc?


----------



## osunick

Another update- performance gauges are now hideable by tapping the speed units under the speedometer (MPH or km/h). Actual metric/imperial units are matched to user preference in the car, so if they do not automatically match your car, let me know. New apk in the doc for testers.


----------



## osunick

Uploaded my Pixel 2XL mount to Thingiverse: https://www.thingiverse.com/thing:5205078


----------



## osunick

FYI, the repo is up, and test builds on Google Play.

https://github.com/osunick/candash
https://play.google.com/store/apps/details?id=app.candash.cluster


----------



## osunick

Made this video with PIP so it's easier to see how CANdash works.


----------



## Ren001

@osunick I did drop a note to Ben Schaffer of Unplugged Performance asking him if he knows anyone to help us with the "missing" signals on the vehicle bus.




Code:


BO_ 558 ID22EPARK_sdiRear: 8 VehicleBus
SG_ PARK_sdiRearChecksum : 56|[email protected]+ (1,0) [0|255] ""  Receiver
SG_ PARK_sdiRearCounter : 54|[email protected]+ (1,0) [0|3] ""  Receiver
SG_ PARK_sdiSensor10RawDistData : 27|[email protected]+ (1,0) [0|511] "cm"  Receiver
SG_ PARK_sdiSensor11RawDistData : 36|[email protected]+ (1,0) [0|511] "cm"  Receiver
SG_ PARK_sdiSensor12RawDistData : 45|[email protected]+ (1,0) [0|511] "cm"  Receiver
SG_ PARK_sdiSensor7RawDistData : 0|[email protected]+ (1,0) [0|511] "cm"  Receiver
SG_ PARK_sdiSensor8RawDistData : 9|[email protected]+ (1,0) [0|511] "cm"  Receiver
SG_ PARK_sdiSensor9RawDistData : 18|[email protected]+ (1,0) [0|511] "cm"  Receiver


----------



## osunick

Ren001 said:


> @osunick I did drop a note to Ben Schaffer of Unplugged Performance asking him if he knows anyone to help us with the "missing" signals on the vehicle bus.
> 
> 
> 
> 
> Code:
> 
> 
> BO_ 558 ID22EPARK_sdiRear: 8 VehicleBus
> SG_ PARK_sdiRearChecksum : 56|[email protected]+ (1,0) [0|255] ""  Receiver
> SG_ PARK_sdiRearCounter : 54|[email protected]+ (1,0) [0|3] ""  Receiver
> SG_ PARK_sdiSensor10RawDistData : 27|[email protected]+ (1,0) [0|511] "cm"  Receiver
> SG_ PARK_sdiSensor11RawDistData : 36|[email protected]+ (1,0) [0|511] "cm"  Receiver
> SG_ PARK_sdiSensor12RawDistData : 45|[email protected]+ (1,0) [0|511] "cm"  Receiver
> SG_ PARK_sdiSensor7RawDistData : 0|[email protected]+ (1,0) [0|511] "cm"  Receiver
> SG_ PARK_sdiSensor8RawDistData : 9|[email protected]+ (1,0) [0|511] "cm"  Receiver
> SG_ PARK_sdiSensor9RawDistData : 18|[email protected]+ (1,0) [0|511] "cm"  Receiver


The other bit is autopilot max speed is no longer on either bus. There is a similar looking signal but it is what the AP computer sets dynamically as a target speed based on both max and conditions on the road.


----------



## pyrlix

Thank you for open sourcing 
I just went ahead and made some changes for myself...








The current consumption is iffy and i need to refactor it to a smoother value, changed the position of some elements, clamped the linear powergauges max and min points to the max output of the battery and removed all the things that sit on the chassis bus that i will never be able to touch or see.
However i might need to change some calc factors...

Hansshows scaling is very iffy. I had to change the font of the gauges to 11dp...


----------



## osunick

pyrlix said:


> Thank you for open sourcing
> I just went ahead and made some changes for myself...
> 
> 
> 
> 
> 
> 
> 
> 
> The current consumption is iffy and i need to refactor it to a smoother value, changed the position of some elements, clamped the linear powergauges max and min points to the max output of the battery and removed all the things that sit on the chassis bus that i will never be able to touch or see.
> However i might need to change some calc factors...
> 
> Hansshows scaling is very iffy. I had to change the font of the gauges to 11dp...


This is great, it's nice to see people taking what I did and hacking on it, nice work getting things to fit on the Hansshow aspect ratio, and it is so much better than the garbage Hansshow UI. It's a shame we can't get to the chassis bus. I wonder if we can figure out how to access the Hansshow CAN hardware.


----------



## pyrlix

osunick said:


> I wonder if we can figure out how to access the Hansshow CAN hardware.


If that can be figured out, then you are inside the chassis bus again... however i am no programmer. Copying some lines and making stuff work somehow i can do, but anything else? Not really...

And yeah, the Hansshow UI is garbo... not fitting to the model 3 at all. I took some ideas of the Model S, as the bottom section, slapped the power bar of the model 3 into the top section. 
The Hansshows aspect ratio allows for so many things infact, one could add a whole slew of things on the sides like on a Model s. 15minute consumption average, trip, odometer... however a trip meter seems to be a bit of a more complicated thing i guess. Or maybe not on the other thought. On the startup i could grab the odometer and push it as a constant and then just substract.


----------



## Ren001

osunick said:


> The other bit is autopilot max speed is no longer on either bus


I had no luck with UP: _Sorry not sure on this stuff or how to help_


----------



## osunick

Ren001 said:


> I had no luck with UP: _Sorry not sure on this stuff or how to help_


Thanks for trying, I hope people like what they see at the track day!


----------



## Ren001

osunick said:


> I hope people like what they see at the track day!


Well your app is the only way to see brake temp, battery temp, torque and so on in a non performance model so I am sure they will like it!


----------



## osunick

Ren001 said:


> Well your app is the only way to see brake temp, battery temp, torque and so on in a non performance model so I am sure they will like it!


Even on the Perf model you just get color coded diagrams, I think. Though UPP will be happy to sell you a $3000 MoTec that can show this info.


----------



## JWardell

I think it's important we highlight @osunick 's mention in Jalopnik!

https://jalopnik.com/this-free-app-gives-the-tesla-model-3-a-real-dashboard-1848459603


----------



## lohlohloh

I am thrilled about this Thread. Thank you so much @all for all the work and hacking!

Is it also possible to get information about critical events like someone is in the blind spot during lane change or if you are approaching a parking vehicle to fast?


----------



## osunick

There is additional alerting that happens when you are actively changing lanes and there's a car detected by the AP cameras. Background flashes red with a specific warning text.


----------



## pengy

Are there any plans for a triple canbus CANServer hardware for the 2021 Model S Refresh? From what I've found, it doesn't look like a lot of the important data is on there, but I wonder if the 3 bus system will be the standard for new cars going forward like cybertruck and roadster.


----------



## norazi

How accurate is the "HP" reading using CanDash? I am assuming its calculated via the raw "kw" data taken from the CanServer; in that case is my MYP really making over 550hp?

- Using the Android Hotspot seems to assign a random ip address to the CanServer each time it's powered up while connecting the Android device (Pixel 2 XL in my case) to the CanServer's WLAN, gives it a static ip address. I found that I have to fiddle with the app to properly connect if it gets a random ip so I am using the CanServer's WLAN for now.
- The issue with the above is that Android doesn't want to auto-connect to a WLAN that doesnt have live internet connection. For now, I am having to manually connect to the CanServer WLAN each time it powers up.


----------



## Randy Spencer

Is this CanDash thing the new official displays for the CanServer? There seems to be a LOT of talk about it in this the official CanServer thread. Maybe CanDash could get its OWN? Not everyone uses Android devices.

I'd like to see bigger CanServer displays as I could fit more info in them (and still read them as old people). I like this size display:

https://www.aliexpress.com/item/1005001621784395.html
Probably a reason why it can't be used, as it doesn't have built in WiFi or a processor to drive it. But would be nice if there was something we could mount above our central display or the wheel.


----------



## Eugenius

pyjamasam said:


> Hmmm. A custom log file that you can write what ever you want to from LUA... That wouldn't be too bad to do. Let me noodle on that.
> 
> chris.


Some time is gone now. What is your decision for that? 

P.S. another more general Idea: If logging filtered signals, does it make sense (optional) to log only if the signal is changed?
Example:
1650545013.323,BattAmps,0.7000
1650545013.333,BattVolts,371.7600
1650545013.333,BattAmps,0.7000
1650545013.343,BattVolts,371.7300
1650545013.343,BattAmps,0.7000
1650545013.353,BattVolts,371.7500
1650545013.353,BattAmps,0.7000
1650545013.363,BattVolts,371.7600
1650545013.363,BattAmps,0.7000
1650545013.374,BattVolts,371.8400
1650545013.374,BattAmps,0.7000
1650545013.383,BattVolts,371.8700
1650545013.383,BattAmps,0.7000
1650545013.393,BattVolts,371.8100
1650545013.393,BattAmps,0.7000
1650545013.403,BattVolts,371.7600
1650545013.403,BattAmps,0.7000
1650545013.413,BattVolts,371.6800
1650545013.413,BattAmps,0.7000
1650545013.423,BattVolts,371.7100
1650545013.423,BattAmps,0.8000

As you see, BattAmps spams a lot (~10ms), but with the same values each time.
My Idea is: at logging start BattAmps saved once 1650545013.323,BattAmps,0.7000 and next time on value change: 1650545013.423,BattAmps,0.8000
That will make logs much smaller without information lost.
Maybe it make sense do this option per signal and for whole log. Additional option can be: save on change only, but in addition every xx ms or s (like a heart beat).


----------



## WrongWheelDrive

pyrlix said:


> Thank you for open sourcing
> I just went ahead and made some changes for myself...
> 
> 
> 
> 
> 
> 
> 
> 
> The current consumption is iffy and i need to refactor it to a smoother value, changed the position of some elements, clamped the linear powergauges max and min points to the max output of the battery and removed all the things that sit on the chassis bus that i will never be able to touch or see.
> However i might need to change some calc factors...
> 
> Hansshows scaling is very iffy. I had to change the font of the gauges to 11dp...


Hey @pyrlix would you be able to send me your modified APK, I have the same hansshow screen installed on my car and I have the same problem you had where everything is small and cut off.


----------



## WrongWheelDrive

No longer need the above. Compiling my own now.


----------



## Randy Spencer

Roci said:


> This is a prototype display I made with cheap OLEDs and an ESP8266 board which connects to CANserver. I also added a feature to the server which allows it to listen for movement of the right scroll wheel on the steering wheel, and scroll through different pages of info, inspired by how a Model S has that abililty on the binacle.
> View attachment 37084


What happened to this project? Did it ever turn into an instructable style public project? Interested in following in your footsteps but I don't see any talk about it or where the hardware was sourced. Really interested in any other display support.


----------

