Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

iPhone app

This site may earn commission on affiliate links.
You might want to note what the pilot current is when charging stopped.
Here's the messages I get from my module:
Nice! i haven't looked for the Date/Time yet. On what sub message ID is it?

I currently check for the Charging true/false flag on ID 96.

The case if from Multicomp, Order code MCG1906

The sourecode, and schematic are ready for download:
RoadsterChargeMonitor v0.1
 
Nice! i haven't looked for the Date/Time yet. On what sub message ID is it?
time tick is on CAN ID 0x81 bytes B5-B8 in little endian. 32 bit value is utime GMT
The case if from Multicomp, Order code MCG1906
cool. Thanks

The sourecode, and schematic are ready for download:
RoadsterChargeMonitor v0.1
Ugh, PIC asm :frown: The C compiler for PIC isn't that heavy is it? The advantage of "C" is that it's easy to port most of the code to a different platform..

Nice work though.

So here's how I plan to solve the "phone number" problem. Rather than hard coding the number in the PIC code, or using callback. Just stick the SIM in a phone and create a phone book entry called "Tesla-Status" with the number you want to send the SMS messages to. Then install the SIM back into your GPRS modem and have the PIC use the AT commands to read the PB and extract the number.
 
I'm wondering if there might be a small market for these gadgets?
I'd think there would be. Still hoping that Tesla comes out with their own solution since supposedly the cars since 2.0 already have the hardware (and it's a bit embarrassing since most other EVs have it). Still, it's nice to have something now since that may be a long time coming and it's an option for the 500 or so 1.5s out there.
 
Nice! i haven't looked for the Date/Time yet. On what sub message ID is it?

I currently check for the Charging true/false flag on ID 96.

The case if from Multicomp, Order code MCG1906

The sourecode, and schematic are ready for download:
RoadsterChargeMonitor v0.1

Great! Thats some nice work. I have to find my soldering iron now ;)

P.S.

I'm wondering if there might be a small market for these gadgets? It would be easy enough to build a small run of printed circuit boards, and build up a batch of them.

For sure! The board doesn't look too exotic ;)

board.png


P.S.2

Ugh, PIC asm The C compiler for PIC isn't that heavy is it? The advantage of "C" is that it's easy to port most of the code to a different platform..

Yeah. As my ASM abilities have faded some years ago, I would appreciate a "C" Version of the code. Maybe someone can rewrite it?
 
Last edited:
time tick is on CAN ID 0x81 bytes B5-B8 in little endian. 32 bit value is utime GMT

Thanks!

Ugh, PIC asm The C compiler for PIC isn't that heavy is it? The advantage of "C" is that it's easy to port most of the code to a different platform..
Yeah. As my ASM abilities have faded some years ago, I would appreciate a "C" Version of the code. Maybe someone can rewrite it?

Yeah i know, its not the prettiest language. But my "C" knowledge is not that good either, and i initially thought ASM would be easier.
I quickly noticed that i had to convert miles to kilometers, multiplying with 1.609, that proved a bit of a challenge. Same thing with converting binary to decimal. These things can be done much easier in C.

Anyway if someone wants to give it a try and encounters problems, let me know, and i'll see if i can help.
Currently only 3% of the Flash is used, and the 256 byte eeprom is not used at all.

I might use that later on for Phone number storage, settings like KM/Miles, roadster 2008/2010 etc..

Nice to see that you played with Eagle already ;)
 
Ok, I tried to translate at least some parts of the brilliant source of Fuzzylogic from ASM to C.

But I got stuck a lot as I'm not working with PICs or ASM at all ;) But I managed to get at least some lines of code...and its kinda running in my PIC18 Simulator (Oshonsoft).

The project was written in MPLAB X IDE beta 4.1 and compiled with the HI-TECH PICC18 9.63.

I tried to get the following parts done (well - there will be some errors for sure):
- Variable definitions
- Initialization of registers and ports
- Delay function (in ms)
- Main loop checking for UART reception, handling CAN Messages and GSM_IO (later two are coded inside the M_timeout() function.
- CAN handler

Following parts need coding as I got stuck there:
- GSM IO functions
- SMS Functions
- UART repection
- config bits

Maybe someone can take on the project. It would be great getting the code to C.

The .zip contains the project from MPLAB X, the .txt is the c source only.
 

Attachments

  • Tesla.X.zip
    155.8 KB · Views: 123
  • tesla_charge_monitor_p18.txt
    6.8 KB · Views: 268
I was so impressed by all the work done to get a charge monitor working, that I ordered all the pieces and started coding. I'm using the modem from Deal Extreme and for now a PICDEM 2 demo board connected to PC with ICD 3 and coding in C with MPLAB IDE v8.63 and Hi-Tech C18 v9.65. I now have the pic talking to the modem, reading the phone book and returning an SMS if I request the status by sending an SMS.

It is time for the CAN buss interface. I would like to use the port on the right side of the console. Does anyone know were I can by a suitable connector?
On the connector, which pins are CANL and CANH, (Tx and Rx)?
 
fox, nice too hear that you continue the good work. I hope you could use some of my translated C code from Fuzzylogic's initial ASM.

At the moment I cannot help you with the CAN lines - I don't have the car yet (I'm just using a can simulator to talk to the project board).
I did a graphic of the can connector on the passenger side - I hope I got the correct lines and didn't swap H and L lines (red wire is CAN_H and the blue wire is CAN_L). Thanks to scott451 who posted the initial pic of the connector.

Can anyone - maybe Fuzzylogic - check if the following graphic is correct?


click for full size
 
Fox, very nice to hear that you are building a charge monitor too.
I have searched for suitable connectors, but haven't found any, so i decided to cut into the can wires directly with these:

871363405-40.jpg


I can verify that the connector pin-out from suxxer is correct.
 
Instead of just seeing it online or at a car demo it was super cool to see Volt and Leaf owners with actual IPhone apps at the rally yesterday. My wife's eyes lit up when an owner showed the Volt app to her. It really made us want one for our Roadster.
AC or heat long before you get in the car, checking the charging state and all the other gadgets in your hand is the coolest new car gimmick in a long time.