Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free > Open ReVolt: open source DC motor controller
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 01-09-2011, 10:56 AM   #11 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
Quote:
Originally Posted by jackbauer View Post
Just purchased the display from 4d systems so will hopefully be able to help out with this project. Have you any pics of the display and information on connecting the hardare?
I have attached some pics of where I am at the moment, quality not great, sorry about that. The first one shows a screen shot of the 4d display. Top 2 rows is the raw ascii string from the, well in this case my Arduino. Then you have the actual values converted from the ascii string, stored in variables and displayed on screen with some other diagnostic info to help in program debuging.

The second picture shows the display, arduino and laptop with the Arduino serial monitor running. This allows me to see what the arduino is sending, again useful for debuging. So far I have not actually connected the 4d display to the actual cougar controller, been working in the warmth of my house instead of in the garage with the car, where the controller is, but the arduino provides a useful data stream to test the software against.

Actual connection to the controller will be up to individual requirements. In my case I also plan on using the displays 2nd serial uart to connect to my bms. The bms will also supply 5v and earth for the display. Just have to make sure the earths are common between the controller and bms. I will use the spark fun rs232 level shifter I mentioned in the first post of this thread to connect the controllers serial port to the display. The same warnings I posted about not connecting the serial port directly to the arduino also apply here. The 4d displays are 3.3 volt ttl serial, but are 5 volt tolerant. On the 4d site they recommend using a resistor on the 4d rx pin when connecting it to a 5v ttl signal, I am using a 330 ohm for this.

Another option would be to power the display from the control board. It should be a fairly simple matter to bring out a 4 conductor cable with 5 volt, earth, rx and tx at ttl levels for connection to the display. It is up to individual users to check and double check their connections as I imagine it wouldn't be difficult to let out the magic smoke on one of these displays if you get the connections wrong.

Attached Thumbnails
Click image for larger version

Name:	P1090165.JPG
Views:	126
Size:	65.9 KB
ID:	7621   Click image for larger version

Name:	P1090166.JPG
Views:	91
Size:	70.6 KB
ID:	7622  
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 01-09-2011, 11:06 AM   #12 (permalink)
Master EcoModder
 
jackbauer's Avatar
 
Join Date: Sep 2009
Location: Ireland
Posts: 734
Thanks: 26
Thanked 304 Times in 171 Posts
Thanks. Soon as the display turns up i'll have a go. BTW how do you program the display? via serial?
__________________
Now, Cole, when you shift the gear and that little needle on the ammeter goes into the red and reads 2000 Amps, that's bad.
www.evbmw.com
  Reply With Quote
Old 01-09-2011, 11:25 AM   #13 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
Quote:
Originally Posted by jackbauer View Post
Thanks. Soon as the display turns up i'll have a go. BTW how do you program the display? via serial?
I use one of these. I think people have made there own as well, have a look on the 4d forums for info.
  Reply With Quote
Old 01-17-2011, 04:51 PM   #14 (permalink)
Master EcoModder
 
jackbauer's Avatar
 
Join Date: Sep 2009
Location: Ireland
Posts: 734
Thanks: 26
Thanked 304 Times in 171 Posts
My 4D systems display turned up today. word of advice. Buy the usb programmer! Had an epic struggle to get the device working on rs232. The culprit is the reset line. For programming it must be pulled low briefly. I eventually found a little obscure circuit on the 4d forums and modified it slightly to avoid using the max232 for the the reset signal. A 1N4001 diode works fine as shown. Now i can get on with programming the thing
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	133
Size:	107.3 KB
ID:	7653   Click image for larger version

Name:	2.jpg
Views:	176
Size:	107.1 KB
ID:	7654   Click image for larger version

Name:	RS232_to_TTL.jpg
Views:	134
Size:	42.9 KB
ID:	7655  
__________________
Now, Cole, when you shift the gear and that little needle on the ammeter goes into the red and reads 2000 Amps, that's bad.
www.evbmw.com
  Reply With Quote
Old 01-18-2011, 11:59 AM   #15 (permalink)
Master EcoModder
 
jackbauer's Avatar
 
Join Date: Sep 2009
Location: Ireland
Posts: 734
Thanks: 26
Thanked 304 Times in 171 Posts
Got a chance today to do a few mods to the code. Its now running on the bench from a cougar control board. Quick video and new code attached.
Attached Files
File Type: zip cougardExp_v2.zip (1,018 Bytes, 40 views)
__________________
Now, Cole, when you shift the gear and that little needle on the ammeter goes into the red and reads 2000 Amps, that's bad.
www.evbmw.com
  Reply With Quote
Old 01-20-2011, 04:56 PM   #16 (permalink)
Master EcoModder
 
jackbauer's Avatar
 
Join Date: Sep 2009
Location: Ireland
Posts: 734
Thanks: 26
Thanked 304 Times in 171 Posts
Made some progress with the display. Cleaned up the refresh to get rid of unwanted data , heatsink temp now in degrees c and rpm measurement implemented. Simple touch screen interface also implemented.
Attached Files
File Type: zip cougardExp_v6.zip (1.7 KB, 48 views)
__________________
Now, Cole, when you shift the gear and that little needle on the ammeter goes into the red and reads 2000 Amps, that's bad.
www.evbmw.com
  Reply With Quote
Old 03-06-2011, 04:21 AM   #17 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
As always, I have to many things to do. Lately I have been working on getting the car on the road. Hope to get back to this reasonably soon. As for schematics, there aren't any. You need to use a RS232 to serial TTL level converter. Spark fun has one, see previous posts.

EDIT: I tell a lie about the schematics, Jack has posted one using a MAX232 chip, see previous posts.

Last edited by Greg Fordyce; 03-06-2011 at 04:24 AM.. Reason: additional thoughs
  Reply With Quote
Old 06-04-2011, 12:54 PM   #18 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
So many things to do, but now that my car is on the road I needed to get my display operational. So I have mounted it in a small lcd screen enclosure I had lying around and got rid of the diagnostic output on the display. For normal daily use I am just displaying Motor Amps, Battery Amps, Temperature and Amp hours (just the integer value for now). Here's a pic.
Click image for larger version

Name:	Dash1.jpg
Views:	179
Size:	71.4 KB
ID:	8621

The display in the middle of the dash (left side of picture) is my BMS display. Here's a close-up.
Click image for larger version

Name:	BMS1.jpg
Views:	208
Size:	70.8 KB
ID:	8622

Ultimately my goal is to combine both displays into one. In theory either my BMS could communicate directly with the Cougar controller, but the serial to video chip is only capable of 16 characters by 9 lines, and as you can see by the distortion on the bottom it doesn't play nicely with the cheap chinese lcd display. Or I could get the 4D display to talk to my bms and bring all the data from the BMS and controller onto one screen. Either way it needs a lot of software coding to achieve.

I was hoping to post the software in this post, but I broke something while tidying it up. However, once I fix it, I will post it.

Greg
  Reply With Quote
The Following User Says Thank You to Greg Fordyce For This Useful Post:
LouMan (06-04-2011)
Old 06-04-2011, 06:57 PM   #19 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
As promised, the latest version of my code.

Code:
#platform "uLCD-32PT_GFX2"

/*----------  CougArd Explorer by Greg Fordyce.  04 June 2011 --------------
------    4DGL Workshop 3 Version 3.1.0.14 - Platform uLCD32PT_GFX2     -------
------------------------compiled size 817 bytes of 15360----------------------

**************************** General Information ******************************

This software carries no warranty or guarantee of any kind! Use at
your own risk, and I make no claims as to its suitability for a particular
function. Prospective users must evaluate the system before using it, and no
liability will be entertained by myself in any shape or form whatsoever.
The software has been produced at low cost for the benefit of
the EV & electronic community. The software is available free via the internet.
Users may modify or adapt the system as they see fit. If you are not fully
competent to work on potentially lethal battery systems and high voltages,
then do not experiment with or use this system. Be aware that vehicle
modifications can lead to invalidated insurance and warranty issues. You the
end user remain fully liable for any modifications made to your vehicle.

****************************** Description ************************************

This software is to capture the real time data stream from the cougar controller
and display it in a graphical interface to the driver. This first version is a
proof of concept and just displays the info as test after capturing and storing the
data to variables. It compiles o.k. but has not yet been tested on the actual
display. It probably has lots of bugs in it at the moment. More info, see links.
http://ecomodder.com/forum/showthread.php/cougard-explorer-13463.html
http://ecomodder.com/wiki/index.php/ReVolt

************************** Connection warning ***********************************

The cougar controller uses a serial RS232 port if built to the standard design.
The uLCD-32PT_GFX2 uses 3.3v ttl level serial comms (5 volt tolerent). You must use
a serial to ttl level shifter/converter. Direct connection of the display to the
serial port will likely damage the display. See cougard-explorer link above for
connection info and schematics.
*********************************************************************************/

var i, j, p, n;
var HStemp;         // In Celsius

var cougRXbuf[33];  // Data string format from controller
                    //"TR=xxx CR=xxx CF=xxx PW=xxx HS=xxxx RT=xxxx FB=xx BA=xxx AH=xxx.x\r\n"

var coug_rtd[9];    // Data from controller
                    // [0] TR 'throttle'
                    // [1] CR 'current reference'
                    // [2] CF 'current feedback'
                    // [3] PW 'PWM'
                    // [4] HS 'heatsink'
                    // [5] RT 'raw throttle'
                    // [6] FB 'fault bits'
                    // [7] BA 'battery amps'
                    // [8] AH 'amp hours' note: the 1/10 value is ignored

/* Heatsink look-up table (LUT). Raw heatsink values(RawHS)correspond to actual temp values (Cval). You may
   substitute your own values making sure you use appropiate corresponding values. You must have a
   RawHS value of 0 at the start and 1024 at the end. You may add any number of values that you like
   to the table. Formula to calculate look-up table for a 'stock' 2C controller can be found here;
   http://ecomodder.com/forum/showthread.php/paul-sabrinas-cheap-diy-144v-motor-controller-6404-411.html#post207171
*/

#DATA
    word RawHS  0, 250, 500, 630, 670, 1024
    word Cval -40,  20,  45,  65,  75,  270
#END



func main()
    gfx_Cls();
    gfx_Set(SCREEN_MODE,LANDSCAPE);
    txt_Width(2);
    txt_Height(2);
    print("Motor Amps    \n");
    print("Battery Amps  \n");
    print("Heatsink Temp \n");
    print("Amp Hours     \n");
    com_SetBaud(COM0,1920);              // Cougar comms is 19200 8-n-1
    repeat
    com_Init(cougRXbuf,64,0);            // set up a interrupt driven ring buffer for comms
    p:= str_Ptr(cougRXbuf);              // pointer
    while(!com_Full()) continue;         // wait till com buffer fills

//      str_Printf (&p,"%s\n\n");    //uncomment to print buffer as diagnostic output

/***************Capture cougar data stream variables to array coug_rtd[]************************/
        i:=0;
        p := p + 3;
        str_GetW(&p, &coug_rtd[i]);      // coug_rtd[0] TR 'throttle'
        p := p + 4;
        i++ ;
        str_GetW(&p, &coug_rtd[i]);      // coug_rtd[1] CR 'current reference'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[2] CF 'current feedback'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]);      // coug_rtd[3] PW 'PWM'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[4] HS 'heatsink'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[5] RT 'raw throttle'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[6] FB 'fault bits'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[7] BA 'battery amps'
        p := p + 4;
        i++;
        str_GetW(&p, &coug_rtd[i]) ;     // coug_rtd[8] AH 'amp hours' note: the 1/10 value is ignored
        p := p + 5;
        com_Init(cougRXbuf,64,0);        // reset RX buffer

/************** Calculate heatsink tempurature from LUT **********************************************
http://ecomodder.com/forum/showthread.php/paul-sabrinas-cheap-diy-144v-motor-controller-6404-412.html#post207267
Thanks to user DJBecker for the look up table example using 16 bit maths to calculate tempurature in Celsius. */

       for (j:=1; coug_rtd[4] >= RawHS[j]; j++); // j is now pointing to the required value in the LUT
       HStemp := coug_rtd[4] - RawHS[j-1];
       HStemp *= Cval[j];
       HStemp += (RawHS[j-1] - coug_rtd[4])*Cval[j-1];
       HStemp /= RawHS[j] - RawHS[j-1];
       HStemp += Cval[j-1];

/************************************* Display controller data***************************************/

        txt_MoveCursor(0,14);
        print("    ");
        txt_MoveCursor(0,14);
        print(coug_rtd[2]);             // Motor Amps

        txt_MoveCursor(1,14);
        print("    ");
        txt_MoveCursor(1,14);
        print(coug_rtd[7]);             // Battery Amps

        txt_MoveCursor(2,14);
        print("    ");
        txt_MoveCursor(2,14);
        print(HStemp);                  // Heatsink tempurature in Celcius

        txt_MoveCursor(3,14);
        print("    ");
        txt_MoveCursor(3,14);
        print(coug_rtd[8]);             // Amp hours, interger value only.

forever
endfunc
Although it only displays 4 values, Motor amps, Battery amps, Heatsink temp and Ah, all values from the cougar real time data stream are captured and stored as variables, with one exception. The Amp hour data is only captured as an integer value. A bit more work is required to get the tenth of an amp figure. But what we do have is a useful drivers display of what I consider to be the most important info while driving.

The controller will need to be set to output the data stream using RTD explorer or moserial. I have set 'rtd_period 1000' and remember to send the 'save' command. I have not tested to see how fast a rtd stream it can handle, updating once a second is fine for driving, not to distracting.

Things that need to be done;

Fancy graphics instead of text display. After all that is why I bought the thing.

Fault bits display.

Data logging to built in uSD card slot. Ideally make the output a csv that is identical to the RTD explorer output.

Get the amp hour data to 0.1 of an ah.

Reduce battery amp limit when a low battery warning is received. Ideally use one of the available digital i/o pins that you can connect to whatever battery warning system you have.

This is some of my immediate goals for this project. Longer term goal is to use the second available serial port to get my bms data into the unit and have one display for both.

As you may have guessed, my projects don't move at any great pace, but I am always open for code submissions if anyone else is wanting to play with one of these 4d displays.

  Reply With Quote
Reply  Post New Thread


Tags
arduino, bms, cougar



Similar Threads
Thread Thread Starter Forum Replies Last Post
$350 Ford Explorer zjrog General Efficiency Discussion 34 03-09-2014 09:30 PM
RTD Explorer Feature Requests (Cougar Controller Interface Software) adamj12b Fossil Fuel Free 52 12-22-2011 10:49 AM
Internet Explorer RandomFact314 The Lounge 13 08-13-2009 04:17 AM
Ford Explorer EV Conversion in MA Matt Herring Fossil Fuel Free 0 05-19-2009 01:10 PM
Ford dusts off old ideas, hopes to get 2011 Explorer to 30 mpg. Tango Charlie EcoModding Central 4 05-14-2009 08:31 PM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com