SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By rastabloke
#126536
Hi, I have a question regarding the best way to go about solving this little problem:

I've have an electronic device that runs off 12v. I need to make it so the device needs to be "updated" once per month, simply meaning the user would need to plug the device into a computer once per month and "update" or the device would not power on.

In it's simplest form, I imagine a usb jack could be hooked up to a small memory card. Within the unit I would need some sort of month/year time keeper. The digits for the month and year could be used to calculate a 16 digit number within the device. The user could then place a new number each month into the text file on the memory card or else the device would not be able to turn on.

I do have basic electronic/programming/soldering skills, and I'm willing to learn as much as needed to accomplish this. I just need to be pointed in the right direction.

Any help would be much appreciated.

Thanks
#126581
"HELP" does not guarantee "help"


You might be able to use a RTC (real time clock) chip, such as DS1307 to keep track of the date. Put code into your program that has a hard coded date, such as say "Jan 1/2012". Have your code check against this date to see if the RTC date is above or below this date. If it's above, do not run any code (using an if/then statement). Then you'd just have to worry about updating your code each time the device was plugged in.
#126595
This sounds like a good way of preventing use of uncalibrated devices.

Anyway, my approach would be to use an RTC aswell. And everytime you update it, store the current time(time@update) to EEPROM. Then in your code, compare the current time/date to the time@update in eeprom. if it is greater than 90 days or whatever, then you can use one of your I/O pins to a switching transistor that will tie the MCLR low. I'm not sure if this is the best way to do it, Im pretty new myself, but another way would be to use something like a circuit breaker, where when you output a high, the "circuit breaker" trips the power line. and the user has to manually reset it before preforming the update.

I hope that makes sense, and I dont know of such a "circuit breaker", but maybe some others here may be able to help you out.
#126597
kfurlong wrote:This sounds like a good way of preventing use of uncalibrated devices.

Anyway, my approach would be to use an RTC aswell. And everytime you update it, store the current time(time@update) to EEPROM. Then in your code, compare the current time/date to the time@update in eeprom. if it is greater than 90 days or whatever, then you can use one of your I/O pins to a switching transistor that will tie the MCLR low. I'm not sure if this is the best way to do it, Im pretty new myself, but another way would be to use something like a circuit breaker, where when you output a high, the "circuit breaker" trips the power line. and the user has to manually reset it before preforming the update.

I hope that makes sense, and I dont know of such a "circuit breaker", but maybe some others here may be able to help you out.
I know the OP wants to not have the device power on, but if he used an IF/THEN/Else statement, he could just prevent any code from running. tying MCLR to a pin could be defeated by cutting the trace.... the code option works better.

I'm not a C guy, but something like "IF DATE_NOW > DATE_ALLOWED THEN .... ELSE RUNCODE". I think you can do this using a while statement in C.. This way, his device powers on.. BUT it doesn't do anything after the date goes past his allowed date. Of course updating code on your device would require an ISP programmer, or some way of getting hex onto the device using a bootloader, but this also prevents people from editing the text file on the memory card.
#126599
Lots of ways to do this, but you probably want something that is hard to "hack", which implies putting it in as few devices as possible.

A good candidate would be an LPC1751, 32KHz crystal and a battery for the RTC. The RTC would keep time and the program in the device would check to see if the month has changed. You can write into the Flash to update the OK info. So while the device can power off, its clock is always running. If the battery dies the device would refuse to work, simply test for year >=2011 and maybe less than 2050, as it comes up other than that when power completely dies.

The code in the LPC1751 can be write and probe protected, so unless you've got a scanning electron microscope or work for the NSA its pretty hard to copy. Another feature of the LPC1751 RTC, is its virtually impossible to drive the oscillator from the outside world, its a very low current feedback and won't run from just any source. Your code could also compare the RTC to the internal oscillator to check for a variation beyond 5% in which case you shut down.

You probably want to put some required function inside the LPC1751 as well, not just controlling a switch, as that could be easily circumvented.
#126610
The best solution would be to figure out some other solution or business model that doesn't require you to cripple the hardware. if Sony, Microsoft, and Nintendo put millions of dollars into anti-hacking technology and still can't succeed, then it's not likely you will.
By rastabloke
#126646
wow, I'm very impressed with the amount of response I have gotten from this! Thank you all, I will be looking into each suggestion in depth... which will most likely lead to more questions.

Just to give a bit more pertinent information, this device is part of a business that I plan to franchise/license out to other people. Having this feature would allow me to ensure they are up to date on their monthly fees, but it does mean it would have to be easy for them to plug in and update the device.