Announcement

Collapse
No announcement yet.

Anyone interested in serial controlled Relay/Input card?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anyone interested in serial controlled Relay/Input card?

    Im thinking of designing and making a Relay/Input card controlled by sending a command via the serial port. Im not gonna work on it yet but hopefuly when Im all done with the outstanding/overdue project Ill look deeply into it.

    Anyway, Im thinking of something along this line :

    The card support 8 relays, 5 digital inputs and 3 analog inputs.

    The relays can be used to control electric windows, central locking, boot lock...etc.

    The 6 digital inputs can be used to sense opened door, boot, ignition on, acc on...etc.

    The 3 analog inputs can be used for sensing car battery voltage, temperature...etc.



    Operating the relay is done by sending a command to the serial port :

    $RELAY1,ON = this turn relay 1 on
    $RELAY1,OFF = this turn relay 1 off
    ...the same goes for RELAY2 - RELAY8





    The card also output the current state of each relays as well as the 8 inputs.
    Example is as follows :

    $RELAY1,OFF = {Relay 1 is currently off, boot is locked}
    $RELAY2,ON = {Relay 2 is currently on, door is open}
    .
    .
    .
    $RELAY8,OFF
    $INPUT1,HIGH = {Door is closed}
    $INPUT2,HIGH = {Bonnet is closed}
    .
    .
    .
    $INPUT5,HIGH = {Driver seatbelt is on}
    $INPUT6,201 = {Main battery voltage is 12.8V}
    $INPUT7,192 = {Backup battery voltage is 12.0V}
    $INPUT8,128 = {CarPC temperature is 40deg C}


    The status of the cards is serialy outputed at lets say 9600,N,8,1 or higher. The update rate can be 1 per sec or more. Input 6-8 are the analog inputs, the measured analog values is represented by decimal values from 0-255. The PC can then decide what to do with these values.



    Those are just some ideas I came up with. The controller is to be based on PIC MCU. If anyone is interested in the project please make a comment. Otherwise Ill just simplify the design just purely for my own need


    Cheers

  • #2
    what is your estimate for a price? would you do every single one completely by hand?
    rebuilding carpc... kinda..

    Comment


    • #3
      what is your estimate for a price? would you do every single one completely by hand?

      The controller shouldnt cost too much to make. Probably 15USD for all the parts or even much less. The relay can be expensive so Ill make that an add on...since not everyone need 8 relays. If only 4 relays is needed then just plug 4 relays in

      Yup Ill start from scratch, the PCB deign and the electronics shouldnt be too hard to do...its coding the PIC that will take most of the time.


      Im not trying to sell it, Ill publish the whole design when done. But someone has to do the windows software for it...cant do those stuff Maybe frodo will integrate it

      I just thought no one has came up with this idea before.

      Comment


      • #4
        Sounds fantastic! I can and would love to do the software for it too.

        I could easily do a C dll plugin callable from any application.

        Expect a PM.
        StreetDeck.com Developer (I am Chuck)
        Get StreetDeck at http://www.streetdeck.com
        The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

        Comment


        • #5
          Sounds fantastic! I can and would love to do the software for it too.



          I may simplify the outputs to binaries if that make the software easier to write...no need to filter out the $RELAY1...$INPUT1

          So the output may look like this :

          1st byte = Relay status
          01010011 {1 = relay is on, 0 = relay is off}

          2nd byte = Digital input status
          XXX10110 {1 = input is high, 0 = input is low}

          3rd byte = Hex value of analog Input 1
          201 {decimal value of analog input 1}

          4th byte = Hex value of analog Input 2
          192 {decimal value of analog input 2}

          5th byte = Hex value of analog Input 3
          128 {decimal value of analog input 3}


          From the above examples, the controller then outputs the HEX values into the PC as follow :

          53
          16
          C9
          C0
          80



          I was only planning to output the status of the card in ASCII so it can easily be viewed in hyperterminal. But either way I dont mind at which format its outputed at as long as theres an agreement which value represent what. The ASCII format may be better for readabilty...abit like the NMEA sentences in GPS receiver.

          If you have any ideas then let me know...maybe more relay supports? more digital or analog inputs? I need to find out which is the best PIC MCU to use

          Comment


          • #6
            I was gonna try my hand at a similar project. I was thinking some sort of shift register setup that would take a stream from a serial output turn on the corresponding outputs. The outputs obviously linked to a whole bunch of relays. If I am right, the amount of relays would be only limited space and budget. The more relays needed, the longer the serial string, and the more clock pulses. I haven't yet figured out all the electronics yet, but I'm working on it.

            As for the controller, I was going to use the Basic Stamp as my processor, since it handles serial output, and I have experience with programming it. Some sort of software on the computer, serial output to the stamp, then some programming on the stamp, serial output to the board of relays.
            2000 Subaru OBS

            Dell P3 @ 900 Mhz
            7" Lilliput TS w/DigitalWW in-dash mount
            80GB External HD

            I am Zero Bitrate....

            Comment


            • #7
              Theres really no need for a shift register. I dont know much about what BASIC stamp are available but the one with the hardware UART the received byte can be directed to a register that control the relays...lets say eight relays.

              Depend how much relay you want to control. If you are talking about 32 relays or more and dont have enough outputs on the MCU then you do need to decode the received bytes and switch that specific relay on/off as dictated by another bit.

              Let say bit 7 is the relay control bit this turn the relay on/off depend if the value is 1 or 0. Bit 0-6 is the relay address to be controlled by bit 7.

              So sending a command in HEX {represented in binaries} :

              1000000 = turn relay 0 on
              1000001 = turn relay 1 on
              0000001 = turn relay 1 off
              ..and so on.

              Of course you can control up to 128 relays which is probably overkill. You need to have 7 bit inputs decoded into 128 latchable lines to hold each relay states.

              But then its up to you how you want to make up your own protocol/commands. But thats how I would do it if I need that much relays. Another things is probably better to make the design cascadable since some may only require 10 relays. In this case you may want to define an ID for each relay card. The PC will then need to send an ID saying which relay board it want to control before a command is sent. Only the board with the correct ID will respond to it


              Good luck...let us know how the results goes

              Comment


              • #8
                As for the controller, I was going to use the Basic Stamp as my processor, since it handles serial output,

                It is also possible to use an MCU without a built in hardware UART. Theres alot of bit-banged software UART routine floating around the net. Ill rather use the one with a built in one to simplify the software...it can get a bit messy when trying to emulate hardware with software.

                Comment


                • #9
                  what about use the parallel port? and also more analog inputs so i can eliminate my ODB II .

                  Comment


                  • #10
                    what about use the parallel port? and also more analog inputs so i can eliminate my ODB II

                    Because the parallel port uses too many pins and speed is not an issue here. Its far more compact/cheaper/efficient to use a PIC with built in com port...less pins, smaller connector, etc.

                    More analog inputs? yup thats possible. Some PIC do have like 16 ADC built in. But then I dont think using this card to get rid of the OBD2 interface is a good idea.

                    Its original function is just to control 8 or so relays, but then I though why not add some inputs from the spare I/O ports, then why not add analog inputs too.

                    The idea had already turned into something more than I original wanted. I think I have to stop there

                    Comment


                    • #11
                      I somenoe needs 12-15 outputs (A/C control) and more (for doors, windows etc) what can be done?? But the same amount of inputs!!!

                      Comment


                      • #12
                        I think this can help you guys

                        http://www.rentron.com/PICX6.htm

                        http://www.rs485.com/pav10r.html
                        :: MSCAR ::
                        .:: Multimedia System Car ::.

                        Comment


                        • #13
                          Originally posted by Ricky327
                          Im thinking of designing and making a Relay/Input card controlled by sending a command via the serial port. Im not gonna work on it yet but hopefuly when Im all done with the outstanding/overdue project Ill look deeply into it.
                          ...
                          Cheers
                          I'm very interested . I've been looking to the http://www.velleman.be/ kit VM110 .
                          Ikea Case. Epia M10000.M1-ATX. 512 Mb. 2,5" 80 GB HDD. 7" Lilliput. BU-303 GPS. Sony Joystick.
                          Status -->
                          Lilliput Installed (not indash yet..)
                          BraveCar 2.5

                          Comment


                          • #14
                            you could also use it to control the remote lead for the antenna, use it to pop the trunk, etc. i like the idea, sign me up.

                            Comment


                            • #15
                              If you need any help, I have done a bit with sending serial commands to PICs, 18 series and 16 series. It wouldnt really be that difficult. The code I just finished recieves about 15 different commands via RS232 using standard 9600,8,N. But I could easily do 57K or higher...
                              What chip do you plan on using? If you go with a PIC I would recommend a 16F88, 16F628 (no A/D), 18F1320 for a low pin count, or it you want a ton of IO you could go toward a 16F877, 18F452, 18F458. The last 2 will get expensive though, but then you can go real crazy and include SPI and CAN communication
                              I also have code worked out for temperature reading, thats no prob...

                              The circuitry should not be too difficult...

                              You could also get a UART USB bridge to make it psudo-usb...

                              Comment

                              Working...
                              X