Storing Large Amounts of Data
Killer Miller
Posts: 4
Just to level set with everyone, I am new to robotics and electronics in general.· I have been a programmer for 10+ years, so I really comfortable with that aspect.· I'm just not used to programming with limited resources.·
Project:
I've modified the code to "follow another BOE bot" to store the path that the robot takes.· While it's "following" (right now it just follows a piece of paper) it stores left and right servo motor values as the program loops and then retraces the path.· However, due to memory limitations, I can only store·4 instructions.· I'd like to be able to store enough instructions for the robot travel between rooms.· I have yet to attempt·using EEPROM, but I already know that·there is not enough memory to accomplish this.· Plus, I'd also like to store a path after the power turns off so I don't have to train it every time is starts.·
Questions
Is there a way to use flash memory?
Am I expecting too much out of my BOE Bot?
Is there another approach I should try?
Here's my retrace steps program for reference:
' {$STAMP BS2}
' {$PBASIC 2.5}
Kpl············ CON·· -35
Kpr············ CON·· 35
SetPoint······· CON·· 2
CenterPulse···· CON·· 750
freqSelect····· VAR·· Nib
irFrequency···· VAR·· Word
irDetectLeft··· VAR·· Bit
irDetectRight·· VAR·· Bit
distanceLeft··· VAR·· Nib
distanceRight·· VAR·· Nib
pulseLeft······ VAR·· Word
pulseRight····· VAR·· Word
counter········ VAR·· Nib
controlLeft········ VAR·· Word(4)
controlRight······· VAR·· Word(4)
FREQOUT 4, 2000,3000
Main:
FOR counter = 0 TO 3
· GOSUB Get_Ir_Distances
· pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
· pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
· controlLeft(counter) = pulseLeft
· controlRight(counter) = pulseRight
· GOSUB Send_Pulse
· PAUSE 1000
· DEBUG DEC counter,CR
· DEBUG DEC PulseLeft,CR
· DEBUG DEC pulseRight,CR
· DEBUG DEC controlLeft(counter),CR
· DEBUG DEC controlRight(counter),CR
· DEBUG CR
NEXT
FOR counter = 3 TO 0
· pulseleft = controlLeft(counter)
· pulseRight = controlRight(counter)
· GOSUB Send_Pulse
·· PAUSE 1000
· DEBUG DEC counter,CR
· DEBUG DEC PulseLeft,CR
· DEBUG DEC pulseRight,CR
· DEBUG DEC controlLeft(counter),CR
· DEBUG DEC controlRight(counter),CR
· DEBUG CR
NEXT
Get_Ir_Distances:
· distanceLeft = 0
· distanceRight = 0
· FOR freqselect = 0 TO 4
··· LOOKUP freqSelect,[noparse][[/noparse]37500,38250,39500,40500,41500], irFrequency
··· FREQOUT 8,1,irFrequency
··· irDetectLeft = IN9
··· distanceLeft = distanceLeft + irDetectLeft
··· FREQOUT 2,1,irFrequency
··· irDetectRight = IN0
··· distanceRight = distanceRight + irDetectRight
· NEXT
RETURN
Send_Pulse:
· PULSOUT 13,pulseLeft
· PULSOUT 12,pulseRight
· PAUSE 5
· RETURN
END
Project:
I've modified the code to "follow another BOE bot" to store the path that the robot takes.· While it's "following" (right now it just follows a piece of paper) it stores left and right servo motor values as the program loops and then retraces the path.· However, due to memory limitations, I can only store·4 instructions.· I'd like to be able to store enough instructions for the robot travel between rooms.· I have yet to attempt·using EEPROM, but I already know that·there is not enough memory to accomplish this.· Plus, I'd also like to store a path after the power turns off so I don't have to train it every time is starts.·
Questions
Is there a way to use flash memory?
Am I expecting too much out of my BOE Bot?
Is there another approach I should try?
Here's my retrace steps program for reference:
' {$STAMP BS2}
' {$PBASIC 2.5}
Kpl············ CON·· -35
Kpr············ CON·· 35
SetPoint······· CON·· 2
CenterPulse···· CON·· 750
freqSelect····· VAR·· Nib
irFrequency···· VAR·· Word
irDetectLeft··· VAR·· Bit
irDetectRight·· VAR·· Bit
distanceLeft··· VAR·· Nib
distanceRight·· VAR·· Nib
pulseLeft······ VAR·· Word
pulseRight····· VAR·· Word
counter········ VAR·· Nib
controlLeft········ VAR·· Word(4)
controlRight······· VAR·· Word(4)
FREQOUT 4, 2000,3000
Main:
FOR counter = 0 TO 3
· GOSUB Get_Ir_Distances
· pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
· pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
· controlLeft(counter) = pulseLeft
· controlRight(counter) = pulseRight
· GOSUB Send_Pulse
· PAUSE 1000
· DEBUG DEC counter,CR
· DEBUG DEC PulseLeft,CR
· DEBUG DEC pulseRight,CR
· DEBUG DEC controlLeft(counter),CR
· DEBUG DEC controlRight(counter),CR
· DEBUG CR
NEXT
FOR counter = 3 TO 0
· pulseleft = controlLeft(counter)
· pulseRight = controlRight(counter)
· GOSUB Send_Pulse
·· PAUSE 1000
· DEBUG DEC counter,CR
· DEBUG DEC PulseLeft,CR
· DEBUG DEC pulseRight,CR
· DEBUG DEC controlLeft(counter),CR
· DEBUG DEC controlRight(counter),CR
· DEBUG CR
NEXT
Get_Ir_Distances:
· distanceLeft = 0
· distanceRight = 0
· FOR freqselect = 0 TO 4
··· LOOKUP freqSelect,[noparse][[/noparse]37500,38250,39500,40500,41500], irFrequency
··· FREQOUT 8,1,irFrequency
··· irDetectLeft = IN9
··· distanceLeft = distanceLeft + irDetectLeft
··· FREQOUT 2,1,irFrequency
··· irDetectRight = IN0
··· distanceRight = distanceRight + irDetectRight
· NEXT
RETURN
Send_Pulse:
· PULSOUT 13,pulseLeft
· PULSOUT 12,pulseRight
· PAUSE 5
· RETURN
END
Comments
Here are your questions copied, and numbered to correspond to the replies below:
Questions:
1, Is there a way to use flash memory?
Yes, but off-board EEPROM may be all you need. Additionally, if speed is the issue, take a look at FRAM by Ramtron:
http://www.ramtron.com/
Here is a link to some applications notes, thanks to Dr. Tracy Allen, for use of an Atmel flash unit:
http://www.emesystems.com/BS2flash.htm
2. Am I expecting too much out of my BOE Bot?
Not if you're willing to put the time and effort into devising an appropriate algorithm to program this re-tracing you're hoping to do. I suspect you will need one other parameter which it appears you're not presently capturing. That element is time. I have a feeling you will need to incorporate an off-board time chip (Maxim-Dallas has some excellent units) in order to know how long each "leg" (series of movements) is. I certainly stand to be corrected in my analysis.
OTOH if you're looking for a "canned" solution, or pre-programmed segments (other than for the time chip) I suspect you may be disappointed. Regardless of that, I'm sure·folks with pitch in toassist where and as they can, if you run into any road blocks.
3. Is there another approach I should try?
You might consider SD/CF data cards as storage units for data logging. Here are a couple of them which work well with the PBASIC Stamp:
http://www.sddatalogger.com/
http://www.ghielectronics.com/
http://www.roguerobotics.com/products/electronics/ummc
The SD_Data_Logger is produced by a member of the Stamp Forum, so help is always available.
Regards,
Bruce Bates
· I'm sure the SD Data Logger I sell would work for you. I is designed specially for the Basic Stamp (R).
· You can download the manual from here http://user.pa.net/~bean/sddatalogger/SD%20Data%20Logger.pdf
· It comes with a 32MB SD card.
· I will assist you with the code (via these forums). If you have any questions please ask.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·