Edited Title - Homework board power? see last entry
qxotic
Posts: 47
I am looking for ideas. My project is to use a Basic Stamp to run a program to accept input from a keypad via an EDE1144 encoder. It then compares the input to a passcode list. Then either grants access or denies and records an event log.
I have a BS2 homework board I have been getting the program started on. I am to the point where it accepts the 4 digit code and compares to the list with no troubles. I just ordered the Sparkfun RTC breakout board for getting the time needed for the log. I am confident the log file will not be greater than 500KB if I let it run for 6 months without clearing it. Given this as a parameter, is the USB memory stick data logger the best option for storing the log file?
I want to be able to update the program/codes and get the log using a laptop via USB.
Which BS2p should I order? (I assume I will need a "p" BS2 due to the RTC using the I2C protocol)
What board should I get to be able to install the RTC, memory or data logger onto? Should I use one of the boards from parallax with the programming interface already built in or build one of my own?
Thank you,
Danner
Post Edited (qxotic) : 9/4/2009 2:12:12 PM GMT
I have a BS2 homework board I have been getting the program started on. I am to the point where it accepts the 4 digit code and compares to the list with no troubles. I just ordered the Sparkfun RTC breakout board for getting the time needed for the log. I am confident the log file will not be greater than 500KB if I let it run for 6 months without clearing it. Given this as a parameter, is the USB memory stick data logger the best option for storing the log file?
I want to be able to update the program/codes and get the log using a laptop via USB.
Which BS2p should I order? (I assume I will need a "p" BS2 due to the RTC using the I2C protocol)
What board should I get to be able to install the RTC, memory or data logger onto? Should I use one of the boards from parallax with the programming interface already built in or build one of my own?
Thank you,
Danner
Post Edited (qxotic) : 9/4/2009 2:12:12 PM GMT
Comments
Options for logging:
1) Use Parallax's Memory Stick Datalogger. The data can be logged to one or more PC compatible files ready to process with your laptop
2) Use a couple of AT24LC1024B EEPROMs (4 to be precise) attached to the same I/O pins as the RTC. That'll give you 512K bytes of EEPROM.
... You'll have to write a program (or part of your existing program) to send the log data to your PC via the programming port.
3) Use a Winbond flash memory. These are available in PDIP form in sizes up to 2MB. Like the EEPROM, you'll need a program to download
... the data to your PC. Also, there are no examples for the Stamp that I know of. You'll have to write your own I/O routines. It shouldn't be hard.
Consider the Super Carrier Board. It's laid out pretty much the same as the Board of Education, but for permanent wiring. I've used it for several
permanent projects and it's worked well.
I was thinking of using the extra memory on the Sparfun to store the program for updating the time and date but have not discovered yet how to put it there or call it up when needed.
My main hurdle right now is running out of memory with my variables. What is the best way to address this problem?
Thank you,
Daniel
It's not practical to store part of a program in some kind of external storage since it has to be moved to EEPROM for execution and that's a very slow process. Programs can often be trimmed down by shortening or removing DEBUG statements and shortening strings used in SEROUT or other output statements. Often there are subroutines that are nearly identical that can be combined. Sometimes using a different technique (like table lookup) can simplify a complex program and trim it down in size.
A common practice, is to see if you can reuse, or create constants out of variables. Do you have any chance of that? Can you post your program that you currently have so we can take a look at it? If you use the Attachment Manager, we can look at your program in the BASIC Stamp Editor; which makes working with code easier than cut and paste.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
I think I have attached the file which is part of my program. This part lets me enter the update of time and date from my keypad and updates the sparkfun clock.
A few ideas that may save space I had are:
1. would it help to make the Beep routine a sub? At different times in the program I want a different number of beeps.
2. secs, control, and day (of week) are data I do not track in my program so they can be reused, I would just have to correct/update them before any update to the clock.
I did read about alias yesterday. Is is possible to alias an array? For instance if you had a Nib(15) variable and later wanted to reuse it as a smaller array?
most of this part of my program are taken from different postings I found in the nuts and volts. I am testing this on my BS2 Homework board. I will next be adding the usb data recorder. If I was using a BS2p which could use the I2C protocol instead of the workaround, would it save me much in regards to variables needed?
Thank you,
Daniel
I have attached my work to date which is now consolidated to this one file.
I only have 3 blocks left on the RAM right now. I have ordered the USB datalogger which will be added to store the file from the History sub.
I am very new at this, so please take a look at what I have so far and let me know where I can improve it.
Much of the code was cut and pasted from posted projects and then edited for this project. Some of the coding I copied is not real clear to me. There is/was coding for a variable of "wrdAddr" I am not sure what it was used for.
Next question: there is a second number after the code in the DATA area. I tried doing away with it but could not get the coding right for it to work.
Next question: In the keypad loop, where it waits for a key to be entered from the keypad, I would like to add a timeout to it so that if someone pushes a button and walks away, that digit is not hanging in there and messing up the next person. How do I put a timer in that loop to clear and start over after so much time of no activity?
Is there a good example of how to access the USB datalogger?
Thank you for the input.
Daniel
2) As with most Parallax products, the product page in the webstore has links to documentation and sample programs. Look at the USB datalogger's webstore page for these.
Is it possible to write my time, date, code, note etc.. to DATA and then pull them from there, thereby freeing up their variables?
I have ordered the BS2pe, the super carrier board and the datalogger.
Thank you,
Daniel
My program would only be writing to the memory stick, not reading from it. Does this help me? The buffer which takes up so many bytes in the array, can it be replaced with a FOR LOOP or something similar? What is in these bytes and do I need them? Much of the program example I see is using the array to purge the buffer. Can my data be sent without using a 15 Byte Array for buffer?
Thank you again,
Daniel
There are probably some variables that could get moved into scratchpad ram while the same space is used by the datalogger routines.
and to configure the Datalogger frimware as described in this thread http://forums.parallax.com/showthread.php?p=821241
The latter thread enables you to do away with the configuration code for the logger and also "boots" quicker
The first thread·, using a fixed string as a file name , requires only your existing "history" variables ,·no additional variables are needed.
Jeff T.
Thank you for the links. I had found the one previously. I've read through them a couple of times now still trying to figure it out. I do have a few questions.
Are you using it in UART or SPI? EDITED - from reading the Firmware VDAP pdf I concluded it is UART since only that mode can be changed in the flash file.
Your text folder has a different wiring method than any I see on the datalogger sheet from Parallax. Why the difference?
I read on the Vinculum site, it said to use 47 KOhm, (not 4.7K) as the pull up Resistors, the Parallax sheet does not show any. (since this site only talks about their chip, is that something already built into the datalogger?)
I read the forum on reconfiguring the boot up of the drive, still pretty foggy on that. It sounds very useful for simplifying things. How complicated is it to do?
THe baud rate, you mentioned for the BS2 that 9600 did not work well. Would you suggest going down to 4800 on the BS2pe also, as well as the SCS? (shortened command set)
The links mention power cycling.. and using a pin for cycle power? I get the impression when a power outage occurs, without doing something special, the datalogger would not come back online?
My parts are coming snail mail so I have some time to think before I get to experiment.
Thank you,
Daniel
Post Edited (qxotic) : 8/20/2009 7:45:25 PM GMT
1/ You are right it is UART
2/ The Parallax documents that support the Datalogger revolve around the use of hard wired serial communication flow control·. This requires a 4 wire connection to the····· Stamp , TX , RX , CTS and RTS. The method that I described·relies in the main on the prompt character returned from the Datalogger as flow control and only requires TX·, RX with CTS connected to Vss·.
3/ I have used the logger·and no·resistors without problems.
4/ Reconfiguring the·firmware is very easy and really is worthwhile for several reasons. Ask for more details when you are ready.
5/ Synchronization between the Datalogger and the Stamp relies on the prompt ( > ) , the PBasic instruction is SERIN ,rx,baud,[noparse][[/noparse]WAIT ">"]·. This instruction is not always reliable at speeds greater than 4800. The slower baud rate is compensated for by the lack of the additional overhead in code and a more direct and simplified set of instructions. Not sure about the pe probably needs 4800 also but I know the px will run at 9600.
6/ The logger is very particular about the commands it receives and even a small error can "lock" things up. The only escape from this situation is a reset/powerdown of the logger , ( a part of reconfiguration makes it easier to recover ) . Don't worry about power cycling initially.
Whatever you decide to do when you receive your parts , CTS/RTS or prompt ">" just post back with anything you are unsure about , there are plenty here to help.
Jeff T.
It will be next Wednesday before I have time to pick the project back up, (if the parts come in by then).
Jeff, I am following most of what you answered. I think to be safe I will set the baud at 4800 on mine.
In my case the datalogger is not needed very often. The stamp is always scanning the keypad, but only when there is an entry does it process anything to send to the logger. Is is possible, or advisable, to only power it up when needed? If so, how would you suggest it be connected?
I'll check back Wednesday.
Thank you all again and have a great weekend.
Daniel
Write-only to the USB datalogger can be done with very economical code. The datalogger does not always return back a ">" prompt, but that only occurs when there is some error condition such as no disk present or file name error or disk full. Your code will probably cover all errors with a timeout, or by sending another CR to the data logger to recoup the ">" prompt. For that reason, there is no need for the 15 byte buffer and simply waiting for the ">" (with timeout) will suffice.
I appreciate Jeff's approach that reduces the number of wires required, but if you do have a pin available on your Stamp, the flow control does work very well for the most part. If you are going to use the flow lines, the one that the Stamp can use to tell the datalogger to hold off on sending data is the most important. In the other direction it is not so important as it is unlikely that you will send data fast enough from the Stamp to overrun the datalogger serial buffer. If you use the flow control, you will not have to mess with custom firmware patches, I think, and it will work fine at the default 9600 baud.
Is your application battery powered or tight on power requirements? The datalogger with a USB stick installed will draw about 100 mA. There are two commands for reducing power. SUD (suspend disk) reduces the draw to about 25 mA, and SUM (suspend monitor) reduces it to about 2 mA. The time to power back up is pretty quick. Nevertheless, I always include means to power off the datalogger completely, because I'm trying to run on micro-power from batteries, and also because it provides a failsafe means to recover from things that go bump in the night in unattended remote location. Like Mike pointed out, it does require several seconds for the datalogger to initialize.
Be sure your datalogger has the latest firmware. The initialization speed is improving, as is the compatibility with different USB sticks. The firmware is available from the Vinculum.com web site. It has to be put into the root directory on a USB stick and named "ftrfb.ftd", and then when the datalogger boots up it looks for that file and will automatically update the firmware.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I'm glad you mentioned the firmware updates, since I'm having trouble with it over in the Propeller forum. Is the correct update found on this page under the title of "VDAP Disk And Peripheral Firmware" download "Reflash FTD"? I put it on the stick (with your recommended filename) and it seemed to do alot of USB drive blinking. I'll have to retest my code that I'm having problems with to see if that helps the problem. Thanks for your post.
By the way, the firmware can be downgraded as well as upgraded. It only looks for a ftrfb.ftd file that is different from the one that is currently installed, not necessarily newer. Beware if you leave old versions of the ftrfb.ftd file lurking on USB sticks at the back of a drawer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I got the data logger in. I reformated it using FAT32 and 512. First I connected it to the 4 pins and ran the DataloggerTestV1 program. That program worked fine and I was able to read the data from my computer.
Then I wired it as Jeff mentioned in the Two-Wire-1 file and tried running the SimpleLog program. I remove the drive and hit one, then it detects and gets to the "Be patient......" line where it hangs. The red light on the datalogger stays on as well as the led on the drive itself. Is there a safe way to disconnect the drive when it hangs like this? I am guessing it is safe because it has not gotten to the point of opening a file and writing data yet.
Did the firmware need to be udpated before I tried running this SimpleLog test?
Any suggestions?
Thank you,
Daniel
I do have extra pins available. Which way connecting the logger will use the least number of variables?
For testing I am using my homework board powered by a 9V battery. The finished product will have a computer power supply running it. The 3V line may sometimes drop too low so I was thinking of using the 12V for positive and the 5V line for negative.
I have seen some code examples using the SUD and SUM commands. Since the logger will not be checked often, I want to do it whichever way is the most robust, or can recover from errors on its own. The several seconds to initialize may not be a problem.
I will be sure to have the right firmware filename when I am ready to update it. Thank you.
Thanks again,
Daniel
There is no need to mess with the firmware right now , the program should work as is.
Jeff T.
EDIT: thinking about that a little more it would probably be better to remove the three lines
· PAUSE 3000
· DEBUG "Be patient.........",CR
· SERIN RX, Baud,[noparse][[/noparse]WAIT("No Up"),WAIT ("grade")]
and replace with
SERIN RX, Baud,[noparse][[/noparse]WAIT(">")]
whichever works the better.
Post Edited (Unsoundcode) : 8/26/2009 5:25:22 PM GMT
Thank you for your help.
I tried a couple things, took out the 3 lines and replaced with the other one; noted out the pause; increased the pause to 5000 and tried it with each SERIN command. It still just hangs with the red light on the logger on solid and the light on the cruzer going from bright to dim and back.
I don't know enough about it yet to take a guess as to why.
Daniel
I don't have an answer right now ,when you get to the Device Detected line the Logger only has to wait for the flash drive to finish looking for an upgrade. It seems not to be catching the acknowledgement .
The last thing I would try is to remove the SERIN instruction before "Logger is Ready" completely and see if the program continues successfully.
The baud rates 84 (9600)·and 188 (4800) are for BS2 , BS2e and BS2pe but it seems you have that covered.
thanks again I'll check it out
Jeff T.
Taking that command out, it then asks for a filename... I enter 4 characters and it returns a message showing the four characters with a 1 on the end and "file not found..."
Hope that helps.
Daniel
I have not loaded this yet, wanted to double check here first.
The only change I was not sure of, should I change IPH to IPA? My data is shown on DEBUG as follows:
DEBUG ? Apt(9), ? keycode, ? Note(11), ? TimeZone(1), CR
DEBUG CR, HEX2 clock(3), ":", HEX2 clock(2), ":", HEX2 clock(1), CR ' clock(1) will not need to save to file
DEBUG "20", HEX2 clock(7), "-", HEX2 clock(6), "-", HEX2 clock(5), CR
I hope to be able to read the file from the drive when I connect it to the computer with the above variables showing as follows:
10,1234,1,2,12,30,09,08,27
How do I need to save it to be able to read it from the computer as on the above line?
I still have not had any luck getting the logger to work with just 2 data lines, but seems to work fine with the 4.
Thank you,
Daniel
I would tend to go for IPA initially.
If you end up going with 4 wire (Tx,Rx,CTS and RTS) you might be ok at 9600.
I·have a few thoughts·on·the two wire set up·I would like to PM to you later , I have used the exact same configuration with the BS2 , SX and recently the Propellor with success so I am interested with whats going on in your case. Having said that , if you can get everything to fit with the 4 wire code it might be better for you to use something you already have working.
regards
Jeff T.
I am planning to use a computer's power supply to power the board. I do not have a round power connector. Would the board work as well if I connect a 12V line to the postive 9VDC connector and a 5V line to the negative of the 9VDC connector?
Thank you,
Daniel
I was using the 12 and 3 volt lines for 9 from a computer power supply... but that won't work when I connect my keypad board to it because they share a ground.. which would cause the 3V line and the ground to have a common point.
Thank you,
Daniel