Connecting Electronics & Computers

Discussion in 'Programming' started by rochow, Jul 8, 2010.

  1. #1
    I haven't the foggiest where to even start. Simplistic example:

    I have a pressure sensor in letterbox. It is wired via ethernet to network. When a certain criteria is met (in this case, pressure) it sends a signal over network to a server, which can then process it somehow (such as sending an email notifying of pressure).

    What is this whole interactivity in between connecting electronics and networking? What sort of language/s would you code this stuff with? I'm imagining it's probably too difficult, ideally if there was some sort of "sender and receiver" that simplifies that part of the process, the rest would become simpler.
     
    rochow, Jul 8, 2010 IP
  2. Snell

    Snell Member

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    Snell, Jul 9, 2010 IP
  3. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Snell: no matter what, you are going to have to have a way to connect it the computer. Parallel, I/O Port, USB etc. TCP/IP comes into the stack when you want to control it remotely - phones, psps, laptop etc.

    Where to start? depends on what you want to do. Is it just this single task? or do you want to make loads of stuff in the future?
    If it's just this task, use something like phidgets (http://www.phidgets.com/) - you can program input (sensors) and output (actuators, motors) in almost any language.

    C is the best language to learn for this kind of low level programming (although it can be done in ASM and C++). If you're using some kind of pre-built stack like Phidgets, you can use almost any language... C# is very nice.

    Check out some of my stuff here: http://www.dirtymonkey.co.uk/
     
    Deacalion, Jul 9, 2010 IP
  4. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #4
    Awesome! I've got a few ideas, as long as it's not too much hassle it's something I can mess around with in my spare time.

    The whole idea is basically hook cool stuff up and program it to the computer - mailbox sensor, frontdoor camera etc. There's a bunch of existing products for everything, but each thing has it's only remote or viewing system, rather than an integrated all-in-one solution. The USB things are cool, distance probably comes into play. Assuming that if you plug those USB ones off phidgets into a ethernet port, it would require different programming? Ethernet is such a cheap & useful cable to run everywhere. Wireless possibly? With the mailbox I'd simply have it email me if it detects mail so I know to go check it :) Pretty basic programming stuff like that.
     
    rochow, Jul 9, 2010 IP
  5. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Great stuff, sounds cool! for things like that, you could use something like the 'PhidgetSBC' - which has an ethernet port built into it. It is quite expensive though.

    Another method, just buy something with digital inputs and use the CAT5 cable to make it reach across distances. Not to carry data, just to carry a voltage. Make some mechanical device that closes the circuit when the letterbox is opened. Then you could code something like this to fire once, in C:

    
    // assuming the PhidgetCircuitClosed(), and SendTxtMessage() have already been declared
    while (1) {
        if (PhidgetCircuitClosed() == 1) {
            SendTxtMessage("Letterbox has been opened");
            printf("Letterbox has been opened");
            break;
        }
        // put a delay/sleep in here, to save CPU cycles
    }
    Code (markup):
    or better yet, use C# and attach events to certain actions. For example, when letterbox is opened - send me a text message and turn on the webcam to take a picture.

    I've made something similar with RFID, when I put my keys on the desk - it opens up my email and google talk. When I take my keys off, it fires the event to lock down my computer.
     
    Deacalion, Jul 10, 2010 IP
  6. aprillove83

    aprillove83 Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That is awesome ideas and great stuff. The USB things are really cool.
     
    aprillove83, Jul 31, 2010 IP