Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How would you go about building this?

  1. Jun 4, 2009 #1
    Hello everyone,

    I hope I came to the right place for this type of question. Please assume that I am completely ignorant with regards to circuits/electronics (although if you can go into further detail, that would be very helpful in the long run).

    I am looking to build a simple miniaturized door detection system with the following properties:

    - System can detect when door is open and when door is closed.
    - System stores this information in its memory along with the time when the door was open and when it was closed.
    - One can extract this information and easily read it on a computer.

    It is critical to keep it as small as possible (roughly the size of a bottlecap). If that is not possible, at what size would it be possible? Also, it can not be connected directly to a computer. What is the best form of energy source? More than one way of accomplishing this would be encouraged.

    Thanks a lot guys. Looking forward to hearing from you.
     
  2. jcsd
  3. Jun 4, 2009 #2
    FPGA, hearing aid battery, magnetic sensor, and now go and spy on your neighbor ;)
     
  4. Jun 4, 2009 #3

    vk6kro

    User Avatar
    Science Advisor

    You might be looking for a datalogger.

    You have to put a switch on the door so that it opens or closes the switch when the door is open. This can be stored in the datalogger along with the time.
    There are magnetic switches for doing this. You could put one on a dog door to get a list of times when your dog went outside.

    At some later time, you come along, pick up the datalogger from its hiding place near the door and plug it into a computer.

    Actually doing it or building one yourself might be a different matter if you have no electronics experience.
    Maybe have a hunt on Google for dataloggers. It is a big industry and prices can be high.
    It gets more friendly if you enter "Datalogger DIY". There are lots there, so you might like to have a look.
     
  5. Jun 5, 2009 #4
    Hello guys,

    Thanks for you input.
    I should have added something in my first post. There are certain elements that are priorities and should not be compromised. These are size and price.

    So I am afraid a datalogger is out of the question vk6kro, unless they come in cheaper and smaller form. How much would gander they cost if you built one yourself?

    Deadbeef, do FPGA come in small sizes. I have been told by others that a PICmicro + RTC + EEPROM is the way to go. What advantages and disadvantages do FPGAs have compared to that?

    I should also mention that the system should be able to last about 3 months, with the door opening and closing about 3 times per day.

    Also, lets not forget it should be able to communicate to a PC, in a user-friendly manner. I was encouraged to use RS232/USART. Can you think of any other ways to do so? It is not a concern should a specialized and expensive device be used to read the data.

    Thanks a lot guys, looking forward to hearing more input.
     
  6. Jun 6, 2009 #5

    vk6kro

    User Avatar
    Science Advisor

    Still sounds like a Datalogger.

    If you buy a commercial one in a nice box with flashing lights it will be expensive.

    However, if you look in Google under "Datalogger DIY" there are circuits there that could be built up for the price of the components.

    Dataloggers usually collect data like temperature at regular intervals. You would need to only collect data when the door was opened. So, that is different.

    There are certain costs that are unavoidable just to get the job done.
    You need a real time clock to know when the door was opened. You would want this to be accurate to about a minute or so in 3 months, so it has to be crystal controlled.
    You need memory to store the times.
    You need a battery that will last that long.
    You need a microcontroller to input the data, store the data and recall it when the device is connected to a computer.

    That is already about US$50 in parts.

    You also need someone to make it and test it and show you how to use it.
    Unfortunately this type of assistance doesn't come cheap.

    You could look at the following:
    http://www.robotshop.ca/picaxe-four-channel-datalogger-axe100-2.html [Broken]
    It includes a couple of sensors that you don't need, so they would probably leave them out.

    http://www.rev-ed.co.uk/docs/axe110.pdf

    I would like to use something that already had a clock and storage in it, like a digital camera. That way you could see WHO opened the door. But I can't see any way of doing that with cheap available equipment.
     
    Last edited by a moderator: May 4, 2017
  7. Jun 6, 2009 #6

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    I think you can do everything you need to on a PIC with the exception of the real time clock. However, you could make a crude one in software. PICs come with an impressive array of on-chip peripherals these days. Try to get everything you possibly can on a single chip. This will keep power consumption down. PICs have impressive low power and sleep modes that keep power consumption quite low. With a real time clock running in software though, sleep mode is probably out of the question.
    -
    What is your idea of 'cheap'? If you want this thing small, you are going to have to go with SMT on a circuit board. Are you familiar with the costs of having PC boards manufactured? There are companies out there that do very small quantities, but I am wondering what your budget is? Generally incredibly small and incredibly cheap do not go hand in hand. I could hack something together that you describe pretty easily with parts I have on hand. However, to do it miniaturized requires something other than a proto-board.
    -
    Keep in mind that everything I've said here will require alot of WORK and RESEARCH from you if you are still very green in knowledge of electronics.
     
  8. Jun 6, 2009 #7
    Thanks for your honesty vk6 and thanks for the advice on trying to keep everything on a PIC for decreasing power consumption, averagesupernova. Well at the moment, I don't have a set price on what cheap is, I am just trying to minimize the price as much as possible. I am aware price and size is hard to get, so compromise will be necessary. However, if I were to put one ahead of the other, I would say size has a higher priority.

    Someone gave me this breakdown:
    PIC $1.72
    EEPROM $0.50
    RTC $1.75 - 2.50
    RTC support $0.50 + $0.50
    BATTERY $?
    SWITH = $? perhaps $3.00 -$4.00
    GENERAL SUPPORT COMPONETS $1.00 - $3.00
    PCB = depends where you get it $2.50 - $ 20.00

    You disagree with that assessment, vk6? I would like to hear about why that is the case.

    With regards to me being an amateur, I do intend on hiring some help. Money is less of an issue in that regard. I am just trying to get a general idea from helpful people such as yourselves and get acquainted with the possibilities.
     
  9. Jun 6, 2009 #8

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    Is this something like what you are looking for?
    http://peoplecounter.walkerwirelessco.com/cgi-bin/catalog.cgi?MemoryCounters" [Broken]
     
    Last edited by a moderator: May 4, 2017
  10. Jun 6, 2009 #9

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    I would like to know where you can get a PCB that you will require for the small size for even $20 to say nothing of $2.50. Since EEPROM is available on-chip to alot PICs, throw that one out. Although the RTC and support may be cheap, it will eat up valuable real estate. I'd try doing it in software. I've done hourmeters on PICs with little trouble, a bit more work and an RTC could be had.
     
  11. Jun 7, 2009 #10

    vk6kro

    User Avatar
    Science Advisor

    You might also need a waterproof box. These can be expensive.

    But it is pointless to try to itemize individual components at this early stage.

    Any final design would depend on the experience of the person building it, especially as you would need it to be programmed to suit your exact requirements.
    It would be necessary to make a "mock-up" rough version to prove the concept.
    This is usually how prototypes are produced. I hard wire them and omit the PCB if only one is ever going to be produced.

    It might be possible to power the data collecting microcontroller only when the gate was opened. In those couple of seconds, the micro could power up, read the clock and save the data. This way, battery life would be greatly extended. Only the clock would need power all the time.
     
  12. Jun 7, 2009 #11
    Instead of a magnetic switch, you could make the thing "self-contained" by utilizing an electronic compass, so when the door swings open (assuming a vertical axis for the hinges), the compass would detect the change of orientation, and enough orientation would register as an open door. Another possibility is to use an accelerometer, but then it would be vulnerable to somebody opening the door really slowly. If the axis of the door is hinged horizontally, then an accelerometer/inclinometer would work okay. One of your big costs would be software for the microprocessor, unless you learn to do it yourself. Parts costs are not even half the story.

    Instead of a PIC, you might consider a Basic Stamp. It's something that many people find easy to learn how to use and there are some great forums and lots of ready-made modules to plug into it, so it would be a great way to get started and get a prototype made. CHeck out this website for all kinds of info, and try posting your question on their forum:

    http://www.parallax.com/

    A compass module is available here:
    http://www.parallax.com/Store/Senso...efault.aspx?SortField=ProductName,ProductName

    have fun,
    Mark
     
  13. Jun 7, 2009 #12
    Yes, dlgoff, that's pretty much what it should do. It just has to be much more miniaturized, less powerful and less costly.

    I am not sure averagesupernova, but I'll ask.
    I have been told that a PCB is not necessary. What do you think about that? I'll look into that as well.
    With regards to the external EEPROM, someone did some number crunching and mentioned that 256K is sufficient for 18 door-cycles only. He did mention that some PICs come with 1K EEPROM and that it would be enough for approximately 24 days. Seeing as how I was looking for a system that stores information for 3 months, an external EEPROM was suggested. What are your thoughts on that?
    Also, I will certainly look into an RTC in software form. Thanks for that suggestion.

    Thanks for your thoughts, vk6kro. Extending the systems life using the method you mentioned could prove very useful.

    Warpedwatch, thanks for the alternative outlook regarding the electronic compass and accelerometer.
    I'll look into the Basic Stamp. Correct me if I'm wrong, but is it not quite large?


    Also, I would like to hear what you guys have to say regarding using IR as the sensor?
    Your thoughts on it would be much appreciated.
     
  14. Jun 7, 2009 #13

    Now, the hardest part in your requirement is the size. This'd be easy if it was two inches by two inches... as it stands now you'd need something surface mount.

    Now, let's think of how to store the data. 3 times open close = 6 changes a day. This means we'd need to store 6 dates per day. You could store them in a 32 bit value. 24 bytes per day, 90 days = 2.2 kilobytes, which is easily reachable in a chip's FLASH.

    Now, let's think of how to detect the door open. You can do with a wire and a battery in the worst case. A magnetic switch would be more reliable however.

    A battery is also in question... which battery will you be using? You have to calculate power requirments on it.

    What kind of accuracy do you want? If you want accuracy to a half an hour then you can just attach a 32KHz crystal to the chip and go off of that. Otherwise you'd need something more impressive. (RTC)

    I have some experience with TI's MSP430F20xx, and I think you can utilize that... very low power consumption (so a simple 3.3 PC battery would last you.), you can attach a 33khz crystal, then attach the sensor to one of the legs. You'd get about the size of a bottlecap.

    However, getting the data to a PC would require their programmer ($20).

    Good luck!
     
  15. Jun 8, 2009 #14
    Thank you for your input, Shadowpho!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook