The CANary project

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Might these Solderless Headers
https://www.sparkfun.com/products/10527" onclick="window.open(this.href);return false;
fit in the holes of the display board?

Edit: I tried to push this 1x10 Solderless Header into the holes
on the display board... and I am could not get them into
the holes that are there. So, it appears that these will not
work with this hole size. :(

These Offset Headers are probably offset by 0.04 inches.
http://www.karlssonrobotics.com/shop/arduino-offset-header-8-pin/" onclick="window.open(this.href);return false;
or
https://www.sparkfun.com/products/9374" onclick="window.open(this.href);return false;?

If I re-bend these to form a 0.10 inch offset, and use two rows
of them to "spread" the displays two pin rows from 0.1 to 0.3 inch,
and use the Solderless Headers in the board's holes, I would be
able to plug the display board into a standard breadboard, and
have enough clearance to insert jumper wires under the display board.

Actually, these are not offset to the side, so do not use them
for this side-offset purpose.

Get a normal Stackable Header,
https://www.sparkfun.com/products/11376" onclick="window.open(this.href);return false;
and bend the pins to "jog" 0.1 inch to the side.

What do you think?
Or, some other source of Solderless Headers...
there are some 2x5 on Ebay, of a different design,
but it is not clear what size holes are required.

Perhaps using a normal 1x20 shirt-male to long-male
and bending them out to the side a bit, and then
bend the pins down into the breadboard would work,
since side-loading the pins in the display board's holes
would probably provide enough electrical contact.?
 
I have publish my working code here: http://mbed.org/users/TickTock/code/CANary/. There is still lots to do, but the basic structure is in place. I broke it up into three section: main, utility, and displayModes. The idea was most people would be primarily interested in adding their own custom displays so that can be done in the displayModes code without risking breaking the main code. Simply create a new procedure and add it to the case statement on the updateDisplay procedure at the bottom. In the main block I automatically log the canbus messages and store them in a public array called LastMsg and an associated index array which can be read by the display routines. For example, the following code is how the DTE display routine gets the gids, SOC, and pack volts:

Code:
void printDTE (bool force){
    unsigned short gids, SOC, packV;
    static unsigned short lgids=0, lSOC=0, lpackV=0;
    CANMessage msg;

    msg = lastMsg[indexLastMsg[0x5bc]]; //Get gids
    gids = (msg.data[0]<<2)+(msg.data[1]>>6);
    msg = lastMsg[indexLastMsg[0x55b]]; //Get SOC
    SOC = (msg.data[0]<<2)+(msg.data[1]>>6);
    msg = lastMsg[indexLastMsg[0x1db]]; //Get pack volts
    packV = (msg.data[2]<<2)+(msg.data[3]>>6);

indexLastMsg returns a pointer in the lastMsg array for the requested message. For example indexLastMsg[0x5bc] will return an integer i where lastMsg contains the most recent 5bc message. I did it this way to save memory but still have quick access.

Once you compute the desired values, you can print, plot, or whatever.

Code:
    tt.background(Navy);
    if(force) tt.cls();
    if(force||gids!=lgids){
        tt.foreground(Amber);
        tt.set_font((unsigned char*) Arial28x28);
        tt.locate(10,10);
        printf("%4d gids\n",gids);
        tt.locate(10,200);
        printf("%4.1f kWh\n",(float)gids*0.08);
        tt.set_font((unsigned char*) SCProSB31x55);
        //tt.set_font((unsigned char*) Neu42x35);
        tt.foreground(Green);
        tt.locate(60,96);
        printf("%4.1f mi  \n",(float)(gids-5)*0.33); // Approx for now
        lgids=gids;
    }
    if(force||SOC!=lSOC){
        tt.foreground(Amber);
        tt.set_font((unsigned char*) Arial28x28);
        tt.locate(200,10);
        printf("%4.1f%s\n",(float)SOC/10,"%");
        lSOC=SOC;
    }
    if(force||packV!=lpackV){
        tt.foreground(Amber);
        tt.set_font((unsigned char*) Arial28x28);
        tt.locate(200,200);
        printf("%4.1fV\n",(float)packV/2);
        lpackV=packV;
    }
}

The input "force" is set true when the display mode changes such that you want to repaint the entire display. Normally, you wouldn't want to clear the screen on every update to avoid flicker - you would just update what changed. The force is there to indicate when you should redraw everything regardless of what you think changed. You can look at the code for other examples. I'll add more comments and features and will continue to update the published code along and along but you can always revert to earlier versions if you don't like what I did (the mbed site does revision control automatically). There are a few important pieces still missing (like date entry) but I figured I'd go ahead and share what I had. If you do something cool and care to share please let me know.

P.S. I know I'm a hack. The professional coders out there will, no doubt, cringe at my excessive use of extern and global variables but I was basically raised by wolves when it comes to coding (I've never had any formal programming training).
 
TickTock said:
printf("%4.1f mi \n",(float)(gids-5)*0.33); // Approx for now

Wow.. How many equations are we going to use for this? Isn't it bad enough that many are already using Gids/281?

Oh how I wish we could just use raw Gids and SOC...
 
GregH said:
TickTock said:
printf("%4.1f mi \n",(float)(gids-5)*0.33); // Approx for now

Wow.. How many equations are we going to use for this? Isn't it bad enough that many are already using Gids/281?

Oh how I wish we could just use raw Gids and SOC...

I don't believe that there is anything preventing you from doing that, as most do already.
 
TonyWilliams said:
GregH said:
TickTock said:
printf("%4.1f mi \n",(float)(gids-5)*0.33); // Approx for now

Wow.. How many equations are we going to use for this? Isn't it bad enough that many are already using Gids/281?

Oh how I wish we could just use raw Gids and SOC...

I don't believe that there is anything preventing you from doing that, as most do already.

I know.. it's not a big deal. Just gets confusing sometimes when comparing notes with others.. especially now that "percent" can mean so many things!
 
GregH said:
TickTock said:
printf("%4.1f mi \n",(float)(gids-5)*0.33); // Approx for now

Wow.. How many equations are we going to use for this? Isn't it bad enough that many are already using Gids/281?

Oh how I wish we could just use raw Gids and SOC...
That particular formula (DTE) is actually going to get a LOT more complicated. ;-) The gids/3 (corresponding to ~4mpkWh) approximation was just put in there for now. On the SOC meter, I have it continually calculating my actual driving efficiency with different integration time constants to predict my remain range based on long time average as well as short term. For CANary, I plan to make a graphical representation of the same thing (logarithmic X/time axis with progressively more averaging applied) so you can quickly see your remaining range based on very recent history, day average, week average, seasonal, etc, etc, lifetime. The point of open sourcing the code was to make it very easy for anyone to implement whatever formula they desired at any level of complexity they are comfortable with.
 
The mbed finally came today so I got to work laying out a breadboard. Found I had a handheld project case and a PC board that just fit.

Here is a test fit of all the parts. The displays have header pins added and plug into sockets on the PC board.
p1000992fh.jpg


DC-DC power supply and CAN tranceivers are under the lower display. Eight pin header will connect to standard WattsLeft cable I already have in hand.

p1000993yu.jpg


The display mounting holes are 2mm but you can drill (#44) or tap (2-56) to take a #2 machine screw.

The mbed required a little work to mount as the 40 pin spacing is wider than standard (0.9" spacing) and a socket would have made it too high and hit the displays. Ended up making my own socket and putting it on the back side. So PC board is between mbed and socket. This way I can solder to the floating socket pins and not directly to the mbed pins. The mbed uses standared header pins (0.025" square).

I will let it sit a day and if I still like it tomorrow I will wire it up. Already compiled TickTock's CANary code but will start with his Touch2 code first.

Jim
 
That looks great! The TFT library does support display rotation if you plan to keep the displays in the portrait orientation. What are you doing with the DC-DC supply? Is it to drive the LED?
 
Here is a schematic of the CANary Test Board.

(Please jump to page 14 for updated schematic)

The CAN transceivers (DIP) I have are 5 volt parts so I need a level shifter to be safe on the signals going to the mbed.
 
Nice. I just used a linear regulator. That dc-dc converter should be much more efficient. You'll want that 5v, too, if you decide to add the usb for data logging.
 
Turbo3,
I believe that the Mbed I/O pins are 5v tolerant, so the
level shifter might not be required.

How much current will the Mbed pin 40 (3.3v out) deliver?

Do you want to use the "choke" that Ingineer suggested
on the EV and the CAR CAN buses?

Is the circuit drawn by Eagle?

Looks great, and nice, clear drawing.

Gee, I might be able to use my very old wire-wrap gun!

Parts and sources for DC-to-DC, CAN transceivers, "vol" pot,
enclosure (roughly 4x8x1 inch?), and the proto board
(3x6 inch holes, perhaps?)... please? Thanks.
 
TickTock,
Are the two rows of 20 holes spaced by 0.1 inch
to take a 2x20 header (on your Rev0 board)?

Do you have part numbers and sources for all
the surface mount parts, and the USB connector?
 
Have you considered adding a histogram of
the 96 cell-pair voltages?

It could compute and show the Ave - ((Max - Ave) *1.5)
limit line to identify any "too-low" cell-pairs.

Do you still think this is the criteria used by Nissan
to replace modules?

Have you asked your dealer, or Nissan?

Do you still think that you have a cell-pair that
needs replacing?
 
TickTock said:
Turbo3 said:
TickTock, Who did you use for your PCB boards?

I ordered them through Seeed Studios from Fusion PCB.

They have great prices! I normally use PCBCart, but these guys have very good prices, especially for prototypes since they don't charge any setup fee.

What took forever, the production of the PCB or the transport?
 
vegastar said:
TickTock said:
Turbo3 said:
TickTock, Who did you use for your PCB boards?

I ordered them through Seeed Studios from Fusion PCB.

They have great prices! I normally use PCBCart, but these guys have very good prices, especially for prototypes since they don't charge any setup fee.

What took forever, the production of the PCB or the transport?
Transport. I got an email saying it was shipped 1 week after submitting (and that was during Chinese New Year), but it took a couple weeks after that to arrive). I guess it came by canister on a barge. Next time I will pay for the airmail.
 
garygid said:
TickTock,
Are the two rows of 20 holes spaced by 0.1 inch
to take a 2x20 header (on your Rev0 board)?

Do you have part numbers and sources for all
the surface mount parts, and the USB connector?
I will try to publish the parts list this weekend (unfortunately, my parts came from a variety of sources).

The 20 pin rows inside the mbed connections are not quite .1" away from the mbed but if you want to solder in a header, it will be on the opposite side as the mbed so there shouldn't be a conflict (otherwise the mbed would block access). On Rev3, I put them 0.15" inside so you could solder in a 0.6" standard socket if you wanted (based on a comment from Turbo3). However, I plan to forego the header and just solder the LCD, touchscreen, and speaker connections directly. If something breaks and has to be replaced it really isn't that big a deal to unsolder a few wires. I *do* plan to socket the mbed (THAT would be a PITA). I am using these. [Update: These dont work! Pins on the mbed are too thick to fit]

[edited link]
 
Your link above just gets me to ebay, not any item on ebay.

You ARE planning to solder in the Mbed, or NOT solder it?

We thank you a bunch for sharing the details of your work.
 
Back
Top