Off the wall programming problem
So, I have one of these..
http://www.pololu.com/catalog/product/1350
And I want to talk to it over USB with my PC in order to access the A/D converter and digital outputs but all their examples, SDKs and code are in languages that might as well be Carthaginian as far as I'm concerned, my last programming experience was with Visual Basic for DOS although I do speak FORTH and several varieties of assembly language and even some machine code. I find modern high level languages very confusing to use and have avoided them for a long time now.
I've found the language QB64 that's free and I think I can handle and I've actually managed to send a byte or two to the board through the USB but it triggers an error code every time and I can't figure out what to do to fix it.
http://www.qb64.net/
I used this code to open the (virtual) COM port to the USB.
http://qb64.net/wiki/index.php?title=OPEN_COM
Then I used GET and PUT to send and receive bytes from the device but as I say, I get an error (red light on the board) every time. I've been scratching my head over this for a couple of weeks now and if someone has an understanding of it I'd sure appreciate a hand. The manufacturer's help forum isn't much good to me because none of them seem to be really familiar even with VB6 and something like QB64 is well beyond their ken.
Here's a link to the relevant section of the docs on the board but I'm so out of practice with this stuff I'm having a hard time understanding it.
http://www.pololu.com/docs/0J40/all#5
Warren Stupidity
(48,181 posts)It's free, it comes with samples, and you can download the free version of visual studio. Just start with one of the samples and learn a more useful programming language.
Fumesucker
(45,851 posts)It's not worth going to that much effort, I suppose I'll have to find some other device.
I could write the damn thing in a few dozen lines of code in a language I already know if I could just figure out the interface, I have no desire to learn another language from scratch for a small personal project.
It just means I'll have to redesign my analog interface circuit a bit, I can do that far faster than learning a new language. My favorite programming language is solder anyway.
nebenaube
(3,496 posts)How small?
Fumesucker
(45,851 posts)Batteries are by far the biggest single cost on an EV of any sort and I'm salvaging old laptop 18650 Lithium cells for my ebike. I just want to discharge them at a constant current while measuring the voltage across the cell versus the time and produce graphs like this so I can properly match the cells to make a reliable pack. If it was only a few cells I could easily do it by hand with a meter and a stopwatch but it's going to take a couple of hundred to get the power levels I need (the cells are between a AA and a C cell in size).
As you can see, the greatest current output of this particular cell is between about 3.7 and 4.05 volts, this can vary considerably according to the particular chemistry of any given batch of cells and if you put mismatched ones together then some are running out of power just when others are hitting their peak.
The graphing can be done by pretty much any program that will read data from a file and plot it, all I really need is the voltage readings and the time saved to a file once every second and to flip an output bit to trigger the control relay to turn off the current when the voltage reaches a certain level (anything below 3.0 volts damages Lithium cells).
Here's an example of a completed pack of 18650 cells salvaged from old laptop batteries.
nebenaube
(3,496 posts)I do those for $300-$800...
MannyGoldstein
(34,589 posts)Make sure you know what you're doing.
Second...
Have you checked/set the serial port parameters to make sure that they're what the Pololu unit wants? Parity, data bits, stop bits IIRC? Looks like you need to think about CRC or disabling it?
You might want to start by talking to the board with a terminal emulator on your PC, such as TeraTerm. See if you can get communication going that way, then move to the programming.
Good luck!
Fumesucker
(45,851 posts)All lithium cells are dangerous if abused, the 18650 laptop cells are one of the safer styles around because they were engineered for a low discharge rate (one of the reasons I need so many). I watched a video the other day of someone cutting a fully charged one in half lengthwise with a hacksaw and it didn't even spark, if it had been an A123 cell it would have probably melted the hacksaw blade.
As the old saying goes, technical expertise is in direct proportion to the amount of equipment you have let the magic smoke out of and I have released a great deal over the years.
I do appreciate the warning though.
The Polulu control program operates the board just fine but I can't extract data to a file or automate anything beyond the scripting language in the board though.
According to Polulu the serial settings don't matter over the USB virtual com port, on my PC it's COM 4 and I have set parity, stop bits and so on anyway though.
I'll give the terminal program a shot, I had originally thought about that but it has slipped my mind while I was busy with other portions of the project, thanks for reminding me.
Fifteen years ago I could probably have done this fairly easily but I haven't done any programming in almost that long and a lot of my skills in that department have atrophied pretty badly, makes me feel stupid.
IDemo
(16,926 posts)Beginning with the TZero by AC Propulsion and forward to the Tesla Roadster which uses ACP's battery system under license, using 6,800+ cells. Alan Cocconi is the under-appreciated genius behind the modern electric vehicle industry.
CK_John
(10,005 posts)source code.
It may serve as model.
http://www.scantool.net/downloads/archive/diagnostic-software/
discntnt_irny_srcsm
(18,479 posts)...a source of confusion is endian mismatch.
http://en.wikipedia.org/wiki/Endianness
Good luck with your project.
hunter
(38,309 posts)Sorry, I don't recall what those issues were, and it may have just been my unfamiliarity with quickbasic. I do remember I got it all working with Chipmunk Basic.
http://www.nicholson.com/rhn/basic
Another fellow who is using BASIC to control stuff is this guy:
http://laughton.com/basic
Using Laughton's basic on an android seems ideal for a bicycle project.
Of course these days python is where it's at.
The first "real" operating system I used was BSD. I was using Windows 98SE for a time but I've been using Linux for many years now. Windows irritates me. Simple problems become complex. I didn't "grow up" using Windows. I don't like its quirks.
Anyways, I found I could do most things using Chipmunk Basic's built-in support for pipes and sockets. Connections to I/O ports are easy, and anything else I needed could be accomplished quick-and-dirty using sys and system$ calls.
For example, to play an alert sound:
That battery pack you've built is awesome.
Response to Fumesucker (Original post)
Name removed Message auto-removed