1 2 Previous Next 27 Replies Latest reply: May 3, 2014 9:44 AM by peteroakes Go to original post RSS
  • 15. Re: Self-Destructing arduino code
    sonuame

    See...I told you...EEPROM way is the best...!!

    dont bother abt write cycles, you just have to read the values continously to keep ur sketch active.

  • 16. Re: Self-Destructing arduino code
    dirtdiver

    yes in terms of number of writes available i will be OK, and as far as the legal side goes im not selling this im getting involved in a partnership, and the club is not mine so whats stopping the guy from saing thats his, i have no way of proving that i made the simulator and like i said i can gain leverage when i simply render the teensy useles. (I am also thinking about patenting the simulator but im not sure how to do that or what will the cost or time be like)(The other possibility is a contract which i will look into)

     

    Anyway thanks for the help,i will keep you posted on my progress!

  • 17. Re: Self-Destructing arduino code
    000Plasma000

    Don't patent it!

     

    I tell you, it's a waste of time, money and effort. You need to pay thousands of dollars, and here's the worst part: you have to publish a detailed description of your product and how it works! You're just making it a hundred times easier for some el-cheapo manufacturer to copy it! They won't care if you have a patent. If you do decide to sue someone over copying it, then that's going to set you back quite a bit for a lawyer! There's no way, even if you win, that you'll get that much money back from the patent.

     

    If you decide to sell it (perhaps on a large scale) then there are precautions you can take to stop people from copying it. For example, you could get a custom PCB built for it, and sandpaper off all the markings on the ICs. If and when you decide to go big, then maybe a patent might be feasable. Also, if you don't really care about the money, and just want to get recognised, a patent might be a good idea, even now. Just know that you'll be paying a LOT of money for it. Think of how many goodies you can get on this website for $5000!

     

    ---

     

    Also, @Sunil, the EEPROM method may not necessarily be the best way. In fact, there may not be a 'best' way at all. It's one way of doing things, and it seems feasable. It all depends on what the kill switch is for, how much effort you are willing to go to write the code, how good you are at coding, your time constraints, etc, etc, etc. This kill switch idea is good, but I can see it causing some disputes. A dedicated self destruct button will tick off the club owner much more than a simple discreet reset switch (which by the way, is not analogue as you mentioned before - analogue refers to a range of voltages in this case, the reset switch still uses digital logic), and you can still use the switch for leverage. Just tell the guy you need to take it for 'servicing' and secretly flip the switch while pretending to calibrate stuff, and give him a long technincal explanation as to why it went bust, like "the internal temperature of the dual H-bridge stepper driver rose too far beyond the nominal". He won't know you designed it for leverage (which I'm sure will make him mad and ruin the partnership), but he will know that only you can fix it, which gives you the leverage. Also it requires no extra coding. In addition to this, constantly checking the EEPROM might be quite taxing to the microcontroller, especially since it's doing a LOT of other work - this simulator is pretty complex! You might find that it decreases performance. This might be in the form of jittery servos for example - even with simple programs, if the MCU is checking constantly for, say, a timer value, then the servo just freaks out and goes all over the place! You could optimise this out using interrupts and all that but that just adds to the complexity of your program!

     

    Again, this is also just one way of doing things. It may or may not be better than the EEPROM method, but it's up to dirtdriver to decide

  • 18. Re: Self-Destructing arduino code
    mcb1

    Rahul

    Someone in the Arduino.cc forums did a self destruct, by writing and then reading the address.

     

    The 10/100k write is the MINIMUM the manufacturer guarantees it will work for.

     

    I think (hazy memory) it was more like 1m write cycles he got.

     

     

    Anyway as everyone has posted, it only needs to be written once.

     

    dirtdiver

    You can run the button check routine as an interrupt, or whenever you read other inputs.

    This would clear the EEPROM (or write to it) and on next powerup, when it checks.......

     

    To make it look genuine, after the 'self destruct', you could always make it do a loop that looked like it 'booted' up then died and repeated.

     

    "Genuine failure mate, probably something inside the micro .....I can fix it, but btw about that account..."

     

    I have been known to remove the chip identity by sanding it off, when we didn't want it reverse engineered.

    Black spray paint, or encasement in rubber solution or epoxy (with glass) is also frustrating.

     

    Mark

  • 19. Re: Self-Destructing arduino code
    sonuame

    @Rahul,,

    yeah i am agreed to you , I just told that Reset pin is too much a easy way to stop execution of the microcontroller for that complex machine.

     

    sure continously reading the EEPROM values sometimes may delay in response and surely it will impact the servo one day theoretically...but so far now I have not seen such a case yet..May be i have to do some more EEPROM stress analysis.

     

    What if we mount a small RTC IC (DS1307) and read the EEPROM values after a specefic period of time say once in 2 days or 4 days etc...coz that will surely give the chip some time to relax. And if the value is not there after 2 days...Simulater will shutoff...!! until unless the value is not saved in it again.

     

    DS1307 can last upto 5yrs approx with a single coin cell and we can detect from the Arduino or any other Microcontroller wether RTC is running or not, just incase if somebody plugs out the cell from it and make our program much stable and secured with it...

  • 20. Re: Self-Destructing arduino code
    dirtdiver

    Yeah, thats what i heard about the patenting too, so its out of the game,

    also im not worried about reverse engineering couse all they are going to see is the teensy the code in it cant be extracted as far as I know (it can but it will be all messed up and not full- it will be pretty useles)

    I have a friend lawyer, i will talkmto him about a shor contract declaring that i have rights over the simulator or something similar i dont know yet .

    Im not a good programer,as you can see from the simulator i dont have that kind of money to fool around with , i dont have much time,I will try the EEPROM (at least for the educational purpose of it , but if it slows down the program, then i wont use it)

  • 21. Re: Self-Destructing arduino code
    ntewinkel

    I really like Sunil's idea of it only checking after a few days! Much less obvious that way. You might also make it use a jumper on pins instead of a button, to prevent accidental presses.

     

    You could probably just use millis() to check, as it rolls over after 50 days, which gives plenty of time: http://arduino.cc/en/Reference/millis

    So you could check at startup, and every time millis() is divisible by, say, 200,000 (2.3 days).

     

    Kind of like this:

     

    void setup() {

           if (EEPROM.read(0) == 42) {

                selfDestructLoop();

           }

    }

     

    void loop() {

     

         if (millis() % 200000ul == 0) {  // test with a smaller number. I think you need the "ul" to indicate "unsigned long" to allow for the big number.

              if (EEPROM.read(0) == 42) {

                   selfDestructLoop();

              }

         }

     

         // do regular work

     

         if (selfDestructButtonWasPressed()) {

              EEPROM.write(0, 42);

         }

     

    }

     

    void selfDestructLoop() {

         // blink the warning light.

    }

  • 22. Re: Self-Destructing arduino code
    sonuame

    @Nico,,

    I guess, millis() gets reset once the sim is shutdown, hw exactly we can track the number of days passed

     

    For me RTC was the good choice for the timing purpose..its small, cheap and very much reliable

    I hve made a number of RTCs at home.

     

    @dirtdriver

    So you started the work dude....!!!

  • 23. Re: Self-Destructing arduino code
    ntewinkel

    Hi Sunil,

     

    I agree, millis() gets reset on startup. My thought was that if the sim is running and the button was pressed, it would run for a few days and then shut down. If it is restarted anytime sooner after the button was pressed, it would fail immediately and it would look like there was a startup failure of some sort.

     

    I do like your RTC idea too - they're not too pricey either.

  • 24. Re: Self-Destructing arduino code
    mcb1

    If I might be bold enough to suggest the following :-

     

    Have a number in the EEPROM.

    Also have the number of starts in EEPROM.

    Read both at Power-up/Arduino reset, and add one to starts, re-writing it back to EEPROM.

    You get more than 10k writes, which is 27 years at once a day. (minimum)

     

    If the button is pressed, clear the number OR replace it with the number of starts.

    At next power-up when you read it, either it goes into 'fail' mode, or does x more starts before going into 'fail' mode.

     

    No need for extra hardware.

     

     

    Mark

  • 25. Re: Self-Destructing arduino code
    pyrotuc

    ok, i know i am resurrecting this thread from the dead, i just found it too interesting not to contributed. and disclaimer, it is admittedly very scatterbrained and i was editing on the fly and did not organize *all* of my thoughts well. re-reading it i can tell there is a lot of jumbled thoughts, kinda douglass adams style, but i swear english is my first language. much apologies, very embarrassed, so ADD

     

    ive thought about this very thing quite a bit. i work with a lot of people that dont pay me to ask questions

     

    first, you need to consider the situation. will you be able to physically access the machine to de-activate it? if so, there are a number of ways to trigger this. second, decide on what level of destruction you want. should it present itself as an error, mimic just crapping out? make it clear you are not to be effed with? simple reversible in-code deactivation? erasing values in memory or elsewhere? silent destruction of the mcu? overt destruction?

     

    as for triggering, you could add a female headphones jack, and connect it to pins. get a male, and attach a resistor (possibly variable, rotated by the plug housing), or a capacitor. something like that with a known, easily measurable characteristic. so that a read on the pins can trigger the destruction method. the teensy 3 also has (capacitive?) touch support on a number of pins. these could be attached to screws or the like on the housing of the device, such that when pins are touched in the way you define, it triggers whatever. time delay dead-man switch should be easy on the teensy 3, it just need a crystal and has an RTC already on board. 433/315mhz transmitter/receivers are pretty cheap these days. 4 button remote with a nice receiver board that has 4 pins that go high corresponding to the buttons, momentary such taht you  ould use it like a wireless 4 button keypad, is $4 on ebay. you can attach an IR decoder to the teensy to trigger that way, if the device is in view of a window, for your remote, you can use a ordinary *red* laser pointer in lieu of the IR LED. you can use a microphone to pick up a pulse train and decode, maybe even go all the way to DTMF. use your cellphone up real loud on speakerphone to generate the DTMF tones.along that line, the ultrasonic rangefinders are incredibly cheap, and the normal distance-measuring code would not need much modification to just listen for a pulse train. you can use magnetic reed switches, position on the inside of the housing, such that if you put 1 or more magnets in the corresponding location, it triggers the destruct. taking the same concept further, RFID tags could be utilized. if you want to go all out, there are GSM kits for $60 to give you some seriously *remote* control, you could always use a burner phone with a headset jack, where the audio out wired to a pin, triggering when the phone gets a call, mad-man bomber style.  there are chemical avenues, corroding a contact intentionally, evolution of heat, precipitation of electrolytes in water such that its measured resistance would be different. a vial with powders, that just need water or other liquid added to it start the reaction. or thermal, attach a thermometer somewhere on the housing where you could hit it with a butane lighter, when the temp measures above something that would never happen with normal use. you can use physical pull sticks, askin to the plastic tab you have to pull out of the battery housing for toys. a stripped screw in a stripped socket works. a metal pin can be used to close the gap between two springy brushes. you can use an optical interrupter, to detect the removal or insertion of something into the gap it uses. if you really want to be slick, you can set up a modified screw in a modified socket to act something like a low-key keyswitch, closing the gap of metal contacts, or using the mechanical rotation to activate other rube goldberg like methods (releases a bb that travels down a tube to connect contacts in the bottom, or when it rotates it rotates a flap that interrupts or releases something, makes a magnifying glass burn a string that releases a bird that pecks on a switch and something with a hamster wheel). there are glass-breakage sensors for large glass fronts, i believe it detects the high pitch crack sound, probaby would work mounted to metal housing when you hit it with a hammer.

    you can of course use a timer, setup to put random sway  on the length of time, where you tell the guy you it just needs to be reset periodically. 

     

    a pretty good dead-man style method, could be a timer where it shuts down if you have not reset the timer, by using the capacitive(i think?) touch sens pins on the teensy, connecting to screws or other innocuous things on the surface of the house, so that every x days, you have to go and touch specific points to reset the counter. i doubt anyone would catch on, unless the frequency of needing resets catches attention.

     

    and of course, these methods can be combined.

     

    now the fun part, destruction. roughly in order of less noticeable to very extreme

     

    as mentioned before, code can interact with eeproms. sometimes you can still find the old school ones with the glass window than can be used to erase them with UV light. UV diodes are cheap these days, and those old proms are surely cheap. why kill it slowly with writes when you can flash it at once, more efficiently and surely more consistent results. if you can get another teensy, one can be used to reprogram/deprogram the other, when i got the arduino nano (or is it micro?), one of the example sketches is it acting like a keyboard, typing out a new program in the compiler and uploading to itself. obviously that method relies on having a computer with the compiler installed and running, but as a proof of concept, i imagine its promising. nichrome wire can be very handy for something like this, how is easily conducts with low current, and destroys itself somewhat cleanly, as long as there is nothing near it it can ignite. since its driven by resistive heating, the moment it gets hot enough to melt and lose contact, it stops heating up, so the amount of heat produced can be easily limited by selecting the right diameter.  you can use nichrome wire as the wire for the power supply, with appropriate thickness that with normal use, it does not heat up and melt, but if you make the teensy draw more power like connecting to ground through a resistor, or really anything that causes it to draw more power, it would act like a fuse and disconnect the power supply. encapsulating the nichrome with thin heat-shrink tubing, it will look like any other insulated wire. you can set up a somewhat overly simplistic set of latches using dpdt relays, where it keeps conducting with no power to the coils, but then if you pulse the right coil, it un-latches until manually reset. relays could also be used to connect/disconnect the data pins of USB. you could even get one of the newer tip-ring-ring-shield headphone jack/pug to convey the USB to the plug and then a modified USB cable terminated with TRRS plug.  X10 receiver switches for appliances generally use a switch that will maintain its state with no power, they often employ interesting techniques of a small motor rotating a pin, or something interacting with a very primitive solenoid to move a contact bar across terminals, they are often clever and neat. if you include a battery supply to the teensy, you can generate a pattern from switching the main supply on and off to enable/disable, just have an addition wall plug inside the machine that puts out 3vdc, connected to a pin that looks for the correct pulse sequence.

     

    for a quasi-permanent destruct (as in, probably destroys itself, but possibly recoverable by a smart person), magnetics are an attractive option. wrapping some enameled wire around various components can surely put them out of commission. attacking the unprotected surface of the board, you can cause various shorts by applying something conductive. some nichrome wire twisted together with some solder and plenty flux, will definitely render the board inoperable. use a thickness of nichrome that it acts more as a heating element, melting the solder to splash on the board. if you play it just right, get the nichrome to melt the solder first, where it burns itself out after the solder is gone.

     

    now we get to where the level of obviousness and destruction matters. the above methods would be good if you need to have it look like it did not intentionally self destruct. however, if your "shady" situation allows for creative and overt methods of self-desctuct, you can have a wwwwhhhoollleee lot of fffffuuunnn.

     

    probably the easiest would be to short itself out, likely destroying the uc. theres a bunch a ways to do that, i assume we dont need to regurgitate them here. the most fun would be a pyrotechnic method. as stated earlier, nichrome wire can be very handy in this situation. it can act like a very simple fuse as described above, or it can be used as an initiator for a somewhat more beautiful death. model rocket igniters are very handy if you prefer it over nichrome. if you want to simulate a legit idiopathic shorting out, adding a firecracker to the above solder/nichrome would sure make it sound like it shorted the eff out something good, i recommend lady fingers.you could put a layer of saran wrap over the board, and put a burning yet not explosive powder pyrotechnic mix that more just smolders to ensure a complete destuction. of course, you could just use gunpowder, but dried herb (not THAT king, something more like sage smudge sticks) would be less alarming, as it will just sit there smoldering, surely entertaining anyone nearby with the smoke it puts out.  if you want to totally nerd out, its pretty simple to create a small pinch that would produce an electromagnet pulse (EMP). you just get a thin tube (wrap a piece of paper over a tube that is around 3mm in diameter, get a form something like a 3mm tube. apply a thin layer of glue, and then wrap some 28-30 gauge enameled wire (it can be found it craft sections as well as electronics stores) carefully down the longest you can have the tube go before space is an issue, apply another thin layer of glue let it dry and take it off the form, then fill the inside of the tube with black powder or flash powder. the idea is that you get the coil to be producing the strongest magnetic field it can, and then ignite one end of the tube, as the reaction travels up the tube, it destroys the coil going up the tube, compressing (pinching) the coil, concentrating the EM energy, resulting in a strong EM pulse. ive never done that but it sure sounds cool. itd be a tiny one so the effects would be extremely localized, especially inside a metal housing, so its unlikely anything else would be affected. you could release various caustic and corrosive chemicals onto the board. a few loops of nichrome wire around a small section of a plastic straw holding your chemical of choice. wrap saran wrap over the board a layer or two, put a layer of potassium permanganate and then your straw, filled with glycerine, and then another layer of saran to keep it in place. the kmn04 oxidizes the glycerine in a pretty energetic exothermic reaction that actually gets hot enough it can ignite thermite, and many consider it the prefered method of starting thermote. obviously, if you add powdered iron oxide and aluminum that at least is very small pieces  chopped up, you can get an amazingly hot reaction. if you use magnalium(50/50 al:mg) instead of aluminum, the reaction is much more energetic. it WILL melt a hole through whatever its on, melting a hole down to the ground, china syndrome like. you really, really should probably not do that. but if you do, you will send a damn clear message.

     

    for more realistic methods, use a timer with a generous amount of random controlling the range of time it needs to be reset, using touch sense, twisting a screw, tapping an otherwise normal input button a specific number of times, just like getting cheat codes in mario. "storing" the intended  state inside a relay, system memory, nichrome wire fuse, capacitor, external eep, as detailed towards the top of this thread (i gotta say, thats pretty slick). id definitely do the tip-ring-ring-shield headphone jack to connect to USB should you ever need to repgram the device with out the exploratory surgery. id also run it through a few relays so that the jack could be electrically controlled to connect or disconnect the data pins. if you want to take it to the next lever, get magnetic reed switches, very easy to place them at various random place on the inside of the housing surface, not visible from the outsde. just stick a few magnets in the right place and BAM it either disables  or enables your lockout/restore method, and also makes you look very mysterious.

     

    so yeah, not to just regurgitate the anarchistic cookbook, but you have a whole lot of choices.

  • 26. Re: Self-Destructing arduino code
    kulinti

    you want to kill the chip? When secret button is pressed, energize a relay with contacts tied to 5V and GND of the Arduino or maybe tie the other contact to the mains...that should fry everything

  • 27. Re: Self-Destructing arduino code
    peteroakes

    is the idea to preserve the use of the hardware and only destroy the currently uploaded code or do you want the boot loader, and even the controller rendered un-usable  ?

1 2 Previous Next