User avatar
TomT
Posts: 10647
Joined: Sun Aug 08, 2010 12:09 pm
Delivery Date: 01 Mar 2011
Leaf Number: 000360
Location: California, now Georgia
Contact: Website

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Thu May 17, 2012 10:52 pm

Looks great!
Barbouri wrote:Hi Gary,
Here is another possible option for the display.
http://www.adafruit.com/products/823
It is an blue OLED 16x2 display with ultra-high contrast and any-angle readability.
They are pin/shape/code compatible with 'standard' HD44780 LCDs.
Image
Leaf SL 2011 to 2016, Volt Premier 2016 to 2019, and now:
2019 Model 3; LR, RWD, FSD, 19" Sport Wheels, silver/black; built 3/17/19, delivered 3/29/19.

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Fri May 18, 2012 11:00 am

I agree, I will have to order and try that OLED display.
(Not LCD, but the pixels are individual LEDs.)

I had not tried it before because of its higher cost.
THANKS.

---------
The LEAF's CAN buses all run at 500,000 bits per second, much
faster than those in an average car.

Each message contains about 10 bytes of real data, and
at least several bytes of overhead and checksum.

Burst message rate seems to be about 1 ms, but an average
of 3 or 4 ms is typical.

Cheers, Gary
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

lincomatic
Posts: 316
Joined: Fri Jun 10, 2011 10:01 am
Delivery Date: 06 Apr 2011
Leaf Number: 3819

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Wed May 30, 2012 10:03 am

Gary,
This board was based off my schematic and code, which is hosted at: https://github.com/lincomatic/LeafCAN" onclick="window.open(this.href);return false;
You can get information on how to get Arduino set up to compile my firmware from my blog: http://blog.lincomatic.com/?tag=can-bus

Note that the board has 2 serial ports. The idea is to use the first port to communicate with the board via an FTDI cable for logging and control.
The second port is for hooking up a bluetooth adapter.
There is a row of I/O pins broken out, too for other enhancements.
Since the board supports only 1 CAN transceiver, you can select the active BUS via the jumper block.

I am going to add some code soon to support a pushbutton to toggle the display.

Right now, it stays powered up even when the car is turned off. I am thinking of adding some code to shut off the backlight
after a few minutes of inactivity on the CAN bus.

If anyone makes any useful changes to the firmware, please send them to me, so that I can update the repository on github.

I will get the latest Eagle files from Chris and update that on github, as well.

Let me know if you need any help to get it up and running w/ the firmware compilation.

-Sam

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Thu May 31, 2012 7:47 am

Chris and I have been discussing a Ver2 board. Are you in that loop?

I want (I might need to lay out my own board to get this.):

1. two CAN transceivers, with their Rx TTL side switched by the uP, so the 6x2 jumpers are not needed. Then, the uP should be able to monitor both EV and CAR CAN buses, by switching back and forth between the two Rx lines.

2. a well-placed (optional) USB port (via an FTDI chip) so that the requirement for a GOOD RS232-ro-USB adapter goes away. The port needs to stick out so that the port is usable when the board, with the display, is mounted in my box.

3. I still intend to use an On-Off-On Power Switch, for Always-On, Off, and Auto-On operation. However, if the current drain is very low ... maybe not needed.

4. I would prefer the JTAG re-programming interface, for compatibility with the current SOC-Meter.

5. Provision to support the present 4-digit LED display (since it is bright and the characters are much larger).

6. I have ordered an oled 16x2 display, to see how well it works. So, maybe support that display.

7. more? ... I forget.

Also, I am working on a Logging-to-Flash (USB Flash Drive) version, based on the Mbed board (96 MHz 32-bit). I am writing CAN messages to a Log file now, from BOTH its CAN ports (yes, two). I have a tiny USB Reader for a Micro SD/SDHC card, and maybe that will also work. I hope to try it today.

Cheers, Gary
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

lincomatic
Posts: 316
Joined: Fri Jun 10, 2011 10:01 am
Delivery Date: 06 Apr 2011
Leaf Number: 3819

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Fri Jun 01, 2012 10:16 am

Gary,

Chris & I have discussed some minor changes to the board, nothing drastic.

1. I am not versed enough on the deeper workings of the CAN library to know how to switch back and forth between transceivers. I'm not even sure if it's possible to do on the fly, but maybe it's doable? The hardware would be relatively easy to wire up on a perf board for prototyping .. the transceiver comes in DIP packaging, as well.

2. a well-placed (optional) USB port (via an FTDI chip) so that the requirement for a GOOD RS232-ro-USB adapter goes away. The port needs to stick out so that the port is usable when the board, with the display, is mounted in my box.

Definitely doable. Another option would be to use one of Atmel's USB chips, such as what's being used in Arduino UNO. They run native USB CDC, so no FTDI drivers needed.

4. For JTAG, we just need to add the header. ISP has less pins, though, and the programmers are cheap & readily available.

5. I'm not sure how you are interfacing to the LED, but if there are enough I/O breakouts on the board, it should only be a firmware change.

6. If there's an Arduino library for your oled display, it shouldn't be hard to modify the firmware. As for the hardware side.. we need to know how it interfaces to the MCU.

Mbed dual CAN: cool! Where did you find example CAN bus code for it?

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Fri Jun 01, 2012 3:30 pm

The http://www.Mbed.org" onclick="window.open(this.href);return false; site has many Libraries, and examples of
how to use many of the functions. I used their CAN library,
created two (each attached to different two pins), set the
frequency of each to 500.000 baud and used their CAN-receive
interrupt mechanism to "attach" two receiver routines, that
time stamp the message and dump it ito a circular buffer of
about 1000 messages.

Their language is basically a C++ and is fairly easy to learn
with siple examples for beginers. The Mbed is apparently
used my many students in many classrooms.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

GlennD
Posts: 1493
Joined: Sun Dec 18, 2011 7:14 pm
Delivery Date: 20 May 2013
Leaf Number: 410357
Location: Anaheim

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Sat Jun 02, 2012 7:31 am

I have been using Lincomatic's SOC reader for the past week. As it is it gives me the battery information on 2 lines. For me it does not need any enhancements.

I did not use a circuit board. I used the Olimax development board with the 2551 on a small proto board.

For me, I used a white on blue display that I am not fond of. I just ordered a black on yellowish display that is supposed to lave larger characters. When it arrives from China it should be an improvement.

I am using pin 8 for power instead of pin 16. This allows the unit to come on with the car power button. The 2551 spec says its OK to have it on the buss unpowered.
:
2013 Pearl White SL Premium
Traded for a Cirrus White 2014 Mercedes B (totaled)
2016 Urano Gray eGolf SEL w/ drive assist
Loved the VW but it sat too low for my old body
Back to a Cirrus White 2017 B250e
White Ioniq limited.It sits just fine

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Sat Jun 02, 2012 6:25 pm

Sounds good.
I also leave the CAN transceiver on the CAN bus unpowered.

I have a power switch to turn the Meter On while charging,
when the switched 12v is not ON.

I also have some other displays, but I have not had time to
try them all yet. The oled display might be brighter.
Character size for old eyes is also a consideration.

Cheers, Gary
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

lincomatic
Posts: 316
Joined: Fri Jun 10, 2011 10:01 am
Delivery Date: 06 Apr 2011
Leaf Number: 3819

LeafCAN v1.1 Released

Sat Jun 02, 2012 9:46 pm

I made a couple of minor changes today:

1) Display remaining pack KWh, per Phil's GIDs * 80 / 1000 formula
2) slow down the LCD updating to 250ms, so that the numbers are much easier to read when fluctuating rapidly.

Here is the new display:

Image

The top line, from left to right contains Battery Pack Remaining KWh, SOC ("GIDs"), SOC % (GIDs/281*100), and Remaining Fuel Bars.
The bottom line is unchanged, and contains Battery Pack Voltage, Battery Pack Current Draw (Amps).

Download it here: https://github.com/lincomatic/LeafCAN/downloads
I added LeafCAN.hex, so you don't have to compile it yourself anymore.

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: SOC-LCD-Meter "LeafCAN" with 2x16 Display

Sat Jun 02, 2012 10:49 pm

Maybe display V*A=kW on the second line:
"392.2*-10.2=-3.9" when charging, or
"394.1*120.3=48.4" when driving?

80 Watt-Hours per GID might be the energy fed
into the battery, but it is not the usable energy out.
So, I worry that your kWh might be misleading,
especially at the low end.

However, keep up the Great work. :D
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

Return to “LEAF CANBus”