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 06-03-2010, 07:09 PM   #1 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
CougArd Explorer

I have assymbled one of the Cougar controllers and need a way to protect my lithium battery pack if the SOC is getting low. The controller can limit battery amps if you send a command over the serial port, for example "bat-amps-lim 200" will prevent the controller from drawing more than 200 amps. So the idea is this, when my bms sends a low battery signal I tell the controller to lower battery amps. Just keep doing this, reducing battery amps more and more until you get to 1 amp ( setting the value to zero disables the battery amp limit). This will allow you time to get the car off the road without suddenly cutting all power.

So how to send this command to the controller? I have set myself a few rules, first and most important is the controller will not be modified from the kit/design that is available. This will help prevent forking of the controller project. I will make up the rest of the rules as I come up with them! My controller is sealed now so I can't go in and start changing things.

I am using a Arduino Mega to comunicate over the serial port with the Cougar controller. VERY IMPORTANT, DON'T CONNECT A ARDUINO DIRECTLY TO THE SERIAL PORT ON THE CONTROLLER. The voltages on the controller serial port are +/-10 volts and will likely fry something. You need to use a serial to ttl adapter that converts the serial voltages to the 5v ttl voltage on the arduino. I am using a Sparkfun RS232 Shifter SMD
It took me a while to figure out how to connect it. You need a "null modem" or crossover cable, basically it switches pin 2 and 3 on the rs232 ports. Then to connect to the arduino you connect RX on the Shifter to TX on the Arduino and TX to RX, plus a 5v and ground wire. The reason I am using the Mega is it has 4 hardware UARTS for serial comunication. I have a Tellymate Shield connected to the main serial port, the cougar connected to the second and my BMS will be connected to the third, sending battery amp and amp hour data.

So far I can send commands to the controller, save and display the data stream on a lcd monitor. By connecting the low voltage warning from the BMS, to the Arduino, it will then send the appropiate commands to the controller. I will probably start with a simple look up table such as;

warning 1 - 200 amps
warning 2 - 150 amps
warning 3 - 100 amps
warning 4 - 50 amps
warning 5 - 20 amps
warning 6 - 1 amp


I will post the sketch after I have done some more work on it.

Greg

Attached Thumbnails
Click image for larger version

Name:	00001.jpg
Views:	169
Size:	120.3 KB
ID:	6116   Click image for larger version

Name:	00002.jpg
Views:	150
Size:	104.8 KB
ID:	6117  
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 06-03-2010, 11:59 PM   #2 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
That is very clever, and just plain beautiful. You are what they call an "Engineer". They grow them real smart over there in Scotland!

By the way, if I had my own controller, yours would look way more fancy and professional. Nice job!
__________________
kits and boards
  Reply With Quote
Old 11-20-2010, 04:02 PM   #3 (permalink)
AC-DC enthusiast
 
mrbigh's Avatar
 
Join Date: Nov 2009
Location: Long Island, NY
Posts: 282

Dual-PWR PHEV - '04 Toyota Prius

Kopper - '79 Bradley Bradley GT-II
Thanks: 123
Thanked 54 Times in 37 Posts
CougArd Explorer

Greg, what is the outcome of your Arduino interface?
__________________
. .. .. . .......
Prius Absolutum Dominium . ..........KOPPER
PHEV conversion since Dec 2006.. . .... .Future EV
. . . . . . . .CALCars # 27. . . . . . . . . . ..on the works now !!
. . . . . . . . . . . . . . . . .. . ........
  Reply With Quote
Old 11-21-2010, 06:22 AM   #4 (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 mrbigh View Post
Greg, what is the outcome of your Arduino interface?
Sadly at the moment it is on hold. The first priority is getting my EV on the road, after all the CougArd Explorer isn't much use without an EV to put it in. I have all the bits, but other things keep getting in the way, work, major house renovations and life in general. I am thinking about buying a can of time, but even it's on back order!

Seriously though, I am moving away from the Arduino platform for this, at least for the moment. The original reason for choosing the Arduino was because my BMS couldn't support serial comms faster than 9600 baud and the Cougar is at 19200. So the idea was for the CougArd Explorer to sit in between the Controller and my BMS and maybe eventually move the BMS master functions to the CougArd Explorer.

But things have changed on the BMS front and the project can now support 19200 baud serial comms. This is because we have moved from the original Picaxe chips to using bare Microchip pics and the Pic Basic Pro development environment. So now I have the possibility of directly connecting the bms to the controller. The first task will be to get the current limit working as I described above when the battery pack starts getting low. Then I want to monitor data from the controller starting with battery amps and amp hour data. The BMS has a built in current measurement, but I want to use the bms current data for battery charging and dc-dc loads from my pack. This will allow a smaller and more accurate sensor for this and use the controllers motor amp sensor for the motor load.

With the Arduino I was able to send commands to the controller and also read the serial data. Parsing the data string and storing the values to variables was proving a bit harder, but this looks to be quite simple with PicBasic, although I haven't actually tried it yet. Another advantage of PicBasic over the Arduino is connection is possible with a couple of resistors, no RS232 level shifter required.

My plan is to get the car on the road soon and get back to working on this project early in the new year.

Greg
  Reply With Quote
Old 12-05-2010, 11:12 AM   #5 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
CougArd Explorer rides again!

Now that my car is nearly on the road, after more than a year of working on it, I am looking again at my CougArd Explorer idea. The basic idea is to give some of the functionality of the rtd explorer program in a small embedded platform. Originally I was going to use a Arduino for this, hence the name. The Arduino has been ditched, but I like the name so am going to keep it. That, and I am too lazy to think of a new name!

So while I am waiting for my µLCD-32PT(GFX) - 4DGL Display Modules to arrive, I have written some code for it. At this point I want to prove that I can send commands to the controller, receive the data stream and store the values into variables that can be manipulated/displayed. This code should display as text the data from the controller. It compiles o.k., but probably has lots of bugs in it. So here it is, but please note, I am a rubbish programmer. I am however open to lots of suggestions on improving the code.

Code:
#platform "uLCD-32PT_GFX2"

/*----  CougArd Explorer by Greg Fordyce. Version 0.01alpha 05/12/2010 -------
------    4DGL Workshop 3 Version 3.1.0.4 - Platform uLCD32PT_GFX2     -------
------------------------compiled size 791 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 uLSD-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.
*********************************************************************************/
///////////  Constants  ////////////////////////////////////////////////////////////


///////////  Data  /////////////////////////////////////////////////////////////////

#DATA byte rtd_pointer 3,10,17,24,31,39,47,53       // Address locations in cougar data string for values

#END


///////////  Variables  ////////////////////////////////////////////////////////////

var i, p, n;
var cougTXbuf[10];  // This will allow us to build strings of up to 20 characters to send commands to the controller
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

func rtd_capture()                              // This function parses the rtd string and assigns
                                                // word values of all integer numbers found  in the string

    n:=str_Find(&p,"TR");                       // Check for valid string from controller
    if (n > 0 && n < 3)                         // "TR" should be found at front of string
        i:=0;
        while(str_GetW(&p, &coug_rtd[i++]) != 0);     // parse cougarRXbuf and store values to coug_rtd
        com_Init(cougRXbuf,33,0);               // reset RX buffer
    else
        n:=0;                                   // if we get here there is a problem with the string
    endif
endfunc

func main()
    com_SetBaud("COM0","1920");                         // Cougar comms is 19200 8-n-1
    gfx_Cls();
    gfx_Set(SCREEN_MODE,LANDSCAPE);
    txt_Set(FONT_SIZE, FONT2);
    com_Init(cougRXbuf,33,0);                           // set up a interrupt driven ring buffer for comms
    com_TXbuffer(cougTXbuf, 10);                        // set up the TX buffer
    //com_TXbufferHold(ON);                             // probably not required here
    to(cougTXbuf); print("rtd-period 500\r\n");         // Cougar sends rtd string every 500ms
    //com_TXbufferHold(OFF)                             // probably not required here
    pause(10);                                          // wait for response from controller
    while(com_Count()) putch(serin());                  // print echo response from controller to screen

    p:= str_Ptr(cougRXbuf);
    repeat
    while(!com_Full()) continue;                        // wait till com buffer fills
    rtd_capture();                                      // Check rtd data
            if (n != 0)                                 // print rtd variables
                i := 0 ;
                print("Throttle is   ", coug_rtd[i++], "\n");
                print("Current Ref   ", coug_rtd[i++], "\n");
                print("Current Fdbk  ", coug_rtd[i++], "\n");
                print("PWM           ", coug_rtd[i++], "\n");
                print("Raw Heatsink  ", coug_rtd[i++], "\n");
                print("Raw Throttle  ", coug_rtd[i++], "\n");
                print("Fault bits    ", coug_rtd[i++], "\n");
                print("Battery Amps  ", coug_rtd[i++], "\n");
                print("Amp Hours     ", coug_rtd[i], "\n");
            else
                print("ERROR: ", [STR] cougRXbuf, "\n"); // print buffer as diagnostic output
                com_Init(cougRXbuf,33,0);                // reset RX buffer
            endif
    // endif

    forever
endfunc
  Reply With Quote
Old 12-05-2010, 05:49 PM   #6 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
Cougard Explorer on Launchpad

I have added this project to the Ubuntu Launchpad site. It is a code hosting site like Sourceforge that manages revisions in software. One of the neat things is anyone can create a branch of the project, and their changes can be merged with the existing project. Be warned that if you have never used it before the learning curve is very steep, don't ask me any questions about it as I am still trying to figure it out myself.

Anyway here is the link. https://launchpad.net/cougard and you don't need to register to view or download files, only if you want to contribute through the launchpad site.
  Reply With Quote
Old 12-06-2010, 08:20 AM   #7 (permalink)
ReVolt Enthusiast
 
Join Date: Jun 2009
Location: Michigan, USA
Posts: 239
Thanks: 98
Thanked 47 Times in 40 Posts
Quote:
Originally Posted by Greg Fordyce View Post
I have added this project to the Ubuntu Launchpad site. It is a code hosting site like Sourceforge that manages revisions in software. you don't need to register to view or download files, only if you want to contribute through the launchpad site.
Greg,

I added your link to the Open ReVolt Wiki under "Software"; Open ReVolt - EcoModder

Mark
  Reply With Quote
The Following User Says Thank You to sawickm For This Useful Post:
Greg Fordyce (12-06-2010)
Old 12-29-2010, 12:28 PM   #8 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
Small steps and virtual controllers

I have had some time to sit down with the 4d display and have got it to read the data stream from the controller. Well not exactly the controller, but a virtual controller using the arduino that I was originally going to use for this project. I have attached the arduino sketch, it's just a very simple loop that spits out a data stream.

So the display can read the ascii data stream, just have to get it to store the data in some variables, but this bit has me stumped at the moment. So I have posted a question on the manufactures forum. Can't extract numerical values from ascii string. - 4D SYSTEMS FORUM

Greg
Attached Files
File Type: txt CougarSimulator.txt (2.1 KB, 60 views)

Last edited by Greg Fordyce; 12-29-2010 at 12:31 PM.. Reason: added attachment
  Reply With Quote
Old 01-02-2011, 06:15 PM   #9 (permalink)
EcoModding Lurker
 
Join Date: Nov 2009
Location: Scottish Borders, Scotland
Posts: 92
Thanks: 7
Thanked 33 Times in 16 Posts
I've got a simple version that is capturing the data stream. Newest files uploaded here. ~greg.fordyce/cougard/trunk : files for revision 2
  Reply With Quote
Old 01-09-2011, 07:13 AM   #10 (permalink)
Master EcoModder
 
jackbauer's Avatar
 
Join Date: Sep 2009
Location: Ireland
Posts: 734
Thanks: 26
Thanked 304 Times in 171 Posts
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?

__________________
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
Reply  Post New Thread


Tags
arduino, bms, cougar

Thread Tools


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