Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 05-28-2009, 10:57 PM   #11 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
Update, VMLAB refued to even start on my XP box. I'm about ready to say screw this software emulation testing stuff I think. Unless someone else wants to look at simulavr or something and has a glowing report, I'm not putting any faith in the software only simulators.

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 06-08-2009, 05:10 AM   #12 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
I've just finished building a basic test board (uC, rs232, a couple of pots, buttons, leds ...).
For now I'm going to test the serial communication part for the controller on this one. Simple interrupt based transmit only, sending 16bit integers for temperature, pwm and pedal values. There will be no bcd conversion on the controller, I'll just write a dedicated client to receive, convert display and log this data.
  Reply With Quote
Old 06-08-2009, 05:36 AM   #13 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
Ok, can of worms but ok. Adam was messing around with client stuff here: http://ecomodder.com/forum/showthrea...tml#post106367 , I was rooting for java so anyone could use it, have used rxtx a lot Deploying JAVA with RXTX - Rxtx


just for example, here is a sample java prog that sends a character version of the serial bits to stdout and a hex converted version to stderr (9600, com2)
PHP Code:
import gnu.io.CommPortIdentifier;

import gnu.io.SerialPort;

import java.io.InputStream;

import java.io.OutputStream;

public class 
SerialMon {

    static 
InputStream input;
    static 
OutputStream output;
    static 
char[] hexstr = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

    static 
String toHex(int x){
        return 
""+hexstr[x/16]+hexstr[x%16];
    }
    
    public static 
void main(String[] argsthrows Exception{
        
        
CommPortIdentifier portId CommPortIdentifier.getPortIdentifier(
                
"COM2");

        
SerialPort port = (SerialPort)portId.open("serial madness"4000);
        
input port.getInputStream();
        
output port.getOutputStream();
        
port.setSerialPortParams(
                  
9600,
                  
SerialPort.DATABITS_8,
                  
SerialPort.STOPBITS_1,
                  
SerialPort.PARITY_NONE);
        while(
true){
            while (
input.available()>0){
                
int x input.read();
                
System.out.print((char)x);
                
System.err.print(toHex(x));
            }
        }
    }

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 06-16-2009, 08:38 PM   #14 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
And here is the result: Trevor has written an awt java app, I modified it a bit to work on my linux (with rxtxcomm), and we have a simple java client for the controller. The nice graphic representation of data to follow ...

L.E.: the current value is fake since my setup has the input pin for the current sensor not connected ... The PWM follows very nicely the change in Throttle
Attached Thumbnails
Click image for larger version

Name:	snapshot1.jpeg
Views:	24
Size:	32.2 KB
ID:	3709  
  Reply With Quote
Old 06-16-2009, 09:36 PM   #15 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,829

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,366
Thanked 1,115 Times in 730 Posts
Awesome! But I think 1701 for current might be a bit optimistic?
__________________
kits and boards
  Reply With Quote
Old 06-17-2009, 05:19 AM   #16 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
well ... It looks like my idea of padding the transmissions with a pair of 0xFF is not going to work in all cases: when i slowly increase the throttle I confuse the algorithm at the moment the throttle value is exactly 0xFF and for a brief moment I get really funny values on my screen


l.e.: solution was simple using 0xFD 0xFF sync sequence should be safe. Actually any non identical 2 values above 0x02 each would work for our values (max 511 for all that we read)
Attached Thumbnails
Click image for larger version

Name:	snapshot2.jpeg
Views:	17
Size:	20.4 KB
ID:	3710  

Last edited by charlie_fd; 06-17-2009 at 05:37 AM..
  Reply With Quote
Old 06-17-2009, 02:01 PM   #17 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Fixed the bug. Attached is the client program running on windows this time.

I've uploaded the sources, the ready-to-run java ".jar" file and the binary drivers for windows, linux and mac to a subdirectory in svn for other people to use.

Jar file here: /trunk/javaclient/MotorClient.jar - Open ReVolt - Trac

Drivers: /trunk/javaclient/MotorClient/lib - Open ReVolt - Trac

... and the relevant code from the avr:

Code:
Buffer_StoreElement(&txBuffer, (uint8_t) (tmpThrottle >>8)); // Store value for throttleH into ringbuff
Buffer_StoreElement(&txBuffer, (uint8_t) tmpThrottle); // Store value for throttleL into ringbuff		
Buffer_StoreElement(&txBuffer, (uint8_t) (tmpCurrent >>8)); // Store value for currentH into ringbuff
Buffer_StoreElement(&txBuffer, (uint8_t) tmpCurrent); // Store value for currentL into ringbuff
Buffer_StoreElement(&txBuffer, (uint8_t) (pwmDuty >>8)); // Store value for currentH into ringbuff
Buffer_StoreElement(&txBuffer, (uint8_t) pwmDuty); // Store value for currentL into ringbuff
Buffer_StoreElement(&txBuffer, (uint8_t) 0xF0); // Sync Byte
Buffer_StoreElement(&txBuffer, (uint8_t) 0xFF); // Sync Byte

//enable USART "TX buffer empty" interrupt
UCSRB |= _BV(UDRIE);
Attached Thumbnails
Click image for larger version

Name:	CougarClientWin32.jpg
Views:	16
Size:	21.3 KB
ID:	3712  
  Reply With Quote
Old 06-20-2009, 10:59 AM   #18 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Trevor is making good progress ... He sent me the version with graphic representation of the loged values and it works really nice!
Attached Thumbnails
Click image for larger version

Name:	CougarClientWin32-graph.jpg
Views:	16
Size:	48.8 KB
ID:	3736  
__________________
_____________________________________________

http://svn.fastdigitech.ro/trac/openrevolt/browser

http://svn.fastdigitech.ro/repos/openrevolt
  Reply With Quote
Old 06-20-2009, 11:50 AM   #19 (permalink)
EcoModding Lurker
 
Join Date: Jun 2009
Location: Ontario, Canada
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Java client

Quote:
Originally Posted by charlie_fd View Post
Trevor is making good progress ... He sent me the version with graphic representation of the loged values and it works really nice!
Charlie pointed out a few other things to clean this up a little.

my task list
-adjustable scaling on the chart (or fixed from 0 - 512)
-writing to csv
-change the end of packet suffix to FF F0 ( your code above looks like F0FF?)

the graphing is working pretty well, glitches every once in a while....not sure why, if its because of my pic or a software bug.

Last edited by roverT; 06-20-2009 at 12:13 PM..
  Reply With Quote
Old 06-20-2009, 02:19 PM   #20 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Correct! 0xF0 0xFF. Already changed that in the java code in the svn.

__________________
_____________________________________________

http://svn.fastdigitech.ro/trac/openrevolt/browser

http://svn.fastdigitech.ro/repos/openrevolt
  Reply With Quote
Reply  Post New Thread


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paul & Sabrina's cheap DIY 144v motor controller MPaulHolmes Open ReVolt: open source DC motor controller 7326 03-30-2020 11:48 AM
Ben Nelson's Electro-Metro Build thread bennelson Fossil Fuel Free 1499 12-22-2019 07:24 PM
Longtime Lurker Looking for Miles ZX40 Electric Micro van mods & information rmay635703 Fossil Fuel Free 49 07-06-2014 10:27 PM
Hybrid PWM/Contactor controller turbo-boost bennelson Fossil Fuel Free 24 05-12-2011 10:26 AM
Fun with Voltage Controller Heatsinks Dradus Fossil Fuel Free 14 05-02-2008 03:16 PM



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