Author Topic: data recorder  (Read 10361 times)

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
data recorder
« on: July 17, 2007, 08:02:31 AM »
I don't like idiot lights although the lights that came with the regen controller seem to be accurate in showing when half-discharge is reached. Consequently I wired a cheap DVM to my supply line and plan to add a switch for each battery in the pack so I can see which battery it is when a cell goes bad as shown by the extreme drop in voltage when a load is applied that vanishes when the load is removed.

The other thing I want to do is to add a data recorder so I can record not only the supply voltage but the sensor and power lines as well. If you have any ideas for a suitable data recorder circuit please post them here.

« Last Edit: July 17, 2007, 08:04:31 AM by myelectricbike »

Offline ahend

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 58
Re: data recorder
« Reply #1 on: August 23, 2007, 01:28:03 AM »
Check out this interesting Basic Stamp accessory that could really solve the data storage issue on an autonomous PIC based data logger. Instead of lugging around a laptop, or even a palm device, you could use a small USB thumb drive and a battery operated Basic Stamp module to record multiple input channels. There is a fully developed code example detailing capture, storage, and retrieval.

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #2 on: August 23, 2007, 07:14:58 AM »
That's definitely a possibility at $34.95 since the Create module runs at least $50 with less capability. (Wonder if it is an mass production upgrade of the Create module that can be offered at a lower price?)


Offline ahend

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 58
Re: data recorder
« Reply #3 on: October 01, 2007, 11:08:20 PM »
Here is a fairly simple datalogger that will capture 0 to 4.096VDC readings from 8 seperate channels, and writes the information to a file on an attached USB thumb drive. This system is based on the Parallax Basic Stamp BS2sx ($59) and their USB datalogger module ($34). It includes a Maxim 8 channel, 12 bit analog to digital converter, which can be had as a free sample. Currently the system starts archiving readings upon boot up at a rate of about 8 (one scan of each channel) every second or so. It can be easily adjusted in the code for longer periods. I still need to add a real time clock so the readings can be date and time stamped, and a start stop push button. The circuit draws about 150ma.

This is a sample of the output: (I setup a voltage divider input on channel 0)

1.932,0.001,0.002,0.001,0.002,0.001,0.001,0.002
1.932,0.001,0.002,0.001,0.002,0.001,0.001,0.002
1.933,0.002,0.002,0.001,0.002,0.001,0.001,0.002
1.933,0.002,0.002,0.001,0.002,0.001,0.001,0.002
1.933,0.002,0.002,0.002,0.002,0.002,0.001,0.002
1.933,0.002,0.002,0.002,0.002,0.002,0.001,0.002
1.932,0.002,0.002,0.001,0.002,0.001,0.002,0.002
 
Andy

« Last Edit: October 02, 2007, 03:33:48 PM by ahend »

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #4 on: October 02, 2007, 03:56:17 PM »
Doesn't Microchip offer a 13 channel, 12 bit A/D, with USB on a single chip in its PIC18f series microcontrollers for a heck of a lot less than a Basic Stamp?
« Last Edit: October 02, 2007, 04:36:50 PM by myelectricbike »

Offline ahend

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 58
Re: data recorder
« Reply #5 on: October 02, 2007, 04:47:31 PM »
There are USB ready PIC's, and the variety of I/O and on-board ADC's are plentiful. The beauty of Parallax's USB datalogger module is the VNC1L USB Host Controller IC, which not only provides USB connectivity, but also fronts an interface to the File Allocation Table of a connected mass storage device. All the file system work is handled for you through a series of on-board commands. You would not get that in a single package with a PIC. Even with a decent PIC, I would still use the datalogger module.
PIC's are very attractive though and I am looking into a compiler and programmer so I can take advantage of the speed (Basic Stamps pull programming from a serial EEPROM, which slows things down), and the cost benefits of raw PIC programming and circuit design. A capable microcontroller with on-board ADC can range from $3 to $12. Add a few discrete components and your ready to go. 

Andy

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #6 on: October 02, 2007, 05:26:45 PM »
Seems like I also saw an SD card interface made from an old floppy drive cable that used freeware code to load data directly onto the card without a card reader or a USB interface.

Like this.
« Last Edit: October 02, 2007, 05:32:59 PM by myelectricbike »

Offline OneEye

  • Confirmed
  • Master of Magic
  • *****
  • Posts: 261
Re: data recorder
« Reply #7 on: October 02, 2007, 06:50:33 PM »
I think that interface was tied to an embedded linux distro (OpenWRT or somesuch).  I imagine a PIC or AVR microcontroller could be programmed to read and write to SD, but I sure wouldn't know where to start.

Oh yeah, I wouldn't know where to start to program a PIC or AVR for anything

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #8 on: October 02, 2007, 08:31:07 PM »
I think that interface was tied to an embedded linux distro (OpenWRT or somesuch).  I imagine a PIC or AVR microcontroller could be programmed to read and write to SD, but I sure wouldn't know where to start.

Oh yeah, I wouldn't know where to start to program a PIC or AVR for anything

Oh yeah...? Why not? If I can program anybody can.

All that interface did was increase the memory in a Linksys WRT54G's so enough programming could be added to turn it into a bigger web server. Essentially adding an SD card to a microcontroller would allow it to store more data which could then be uploaded wirelessly or via USB at great savings in cost over writing to a flash drive and then sticking the flash drive in your computer.

Offline OneEye

  • Confirmed
  • Master of Magic
  • *****
  • Posts: 261
Re: data recorder
« Reply #9 on: October 02, 2007, 08:56:15 PM »
Someday I'll get around to learning to program one, just haven't had time yet.

The WRT54G is a full embedded linux app, so much of the programming was already in place for interfacing with the SD card.  I think the linux kernel they use already has wear leveling and stuff like that for handling flash memory.

Never said it couldn't be done, just that it will need a lot of programming to make it work.

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #10 on: October 02, 2007, 11:52:46 PM »
It's not difficult. In fact its fun unless you have a boss yelling at you to get the code done or his nephew that just graduated tech school will enjoy having your job.  :o  ???  :'(

Truth of the matter is if you look at the MS1 you may see a fancy GPS data logger that you can probably buy somewhere for $150. So long as you can buy stuff that will cost less than the time and effort to build than you can buy from China or Japan ,you would have to be hooked on DIY electronics to build instead of buy.
« Last Edit: October 03, 2007, 12:40:15 PM by myelectricbike »

Offline ahend

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 58
Re: data recorder
« Reply #11 on: October 03, 2007, 11:25:17 AM »
Interesting stuff about the SD interface. Apparently, the SD can be read and written via SPI (Serial Peripheral Interface). This would require only the communication lines and a clock source, something every PIC has. 
With the SD card initialized, you can just dump in byte after byte. One would have to adhere to FAT guide lines when setting up the memory block write size to maintain readability by a PC. Here is a decent PIC-SD interface example using the PIC16F876. Neat stuff.

Andy 

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #12 on: October 03, 2007, 02:24:01 PM »
Since the regen controller uses an Atmel ATmega16 it pretty much follows that there is every reason to beleive that adding an SD card to log data is a very doable thing. ...Now how to get Philip to implement a data logger on the controller so the logs can be downloaded to your PC when you get back home? 8)
« Last Edit: October 03, 2007, 03:06:44 PM by myelectricbike »

Offline OneEye

  • Confirmed
  • Master of Magic
  • *****
  • Posts: 261
Re: data recorder
« Reply #13 on: October 03, 2007, 03:36:00 PM »
Nah, just get Phillip to open source the code on the ATmega and we'll have everyone and their brother adding features to it.

Offline myelectricbike

  • PhD. Magic
  • ******
  • Posts: 644
    • How to Build an Electric Bike
Re: data recorder
« Reply #14 on: October 03, 2007, 03:51:33 PM »
That may or may not happen anyway whether Philip goes along with it or not, especially since there is another motor being built by a third party and there are a gazillion 3 phase regen controllers out there albeit at slightly higher cost that someone could use.

Update... my Microchip pci18f4458's just arrived. Now the real fun begins...
« Last Edit: October 09, 2007, 09:14:11 PM by myelectricbike »