Announcement

Collapse
No announcement yet.

Simply serial input circuit

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

  • Simply serial input circuit

    I've been hoping to get a feature added to Frodo to allow it to be used legally in California. Basically I need to implement an automatic mechanism to disable certain features (video playback, applications, etc) when the vehicle is being driven.

    Here is a simple serial port based circuit that will allow you to interface with your brake lights, ebrake switch, gear position switch or whatever you want. It only uses a single SPDT relay. Software must initialize the circuit by setting DTR high and RTS low (unless you want to use the +/-12v or +/-5v rails from your PSU). It can then read the on/off status of the relay over the DSR line. If you want the logic to work in the opposite direction, you can simply set DTR low and RTS high.

    DTR---SWNO
    RTS---SWNC
    DSR---SWPole
    Input --- Coil ---- GND or Input --- Coil --- +V depending on what you're interfacing with.

    I've tested this with a simple vb.net program and it works great. Hopefully one of the major front ends will adopt support for it (or something similar) in a future release.

    BTW, if you need more inputs (upto 4), you can add more relays. The SWPole lines can be hooked up to CD,CTS, and RI also.
    2004 4runner

  • #2
    I'm confused, can you post a better schematic with explanations ?
    [H]4 Life
    My next generation Front End is right on schedule.
    It will be done sometime in the next generation.
    I'm a lesbian too.
    I am for hire!

    Comment


    • #3
      RS232 uses <-3V and >3V for its logic values. All we need to do is supply one of these voltages on one of the input pins and then read the value in software. The voltages can be taken directly from the PSU output or (more conveniently) directly from a set of RS232 output pins.

      Here is a crude drawing. It's just a relay wired up to 3 pins of the serial port (2 outputs, 1 input). The DTR and RTS outputs supply the logic levels we need. The DTR output is set high and the RTS output is set low (in software). An external input drives the relay coil and loops either DTR or RTS back into the DSR input.

      RTS is on the normally closed relay contact and thus the DSR input will get a low value when the coil is off. When the coil is turned on, the normally open contact will be closed and DSR will go high. Put simply, DSR is true when the coil is closed and false otherwise.

      In my case, I would hook the coil up to the signal in my truck that indicates that it is in the PARK gear. When the truck is in PARK, the coil closes and DSR becomes true. When I move the gearshift to any other position, the coil will open and DSR will be low. Whenever DSR goes low, I'd like the software to disable video playback and external apps (including any that might already be playing/running). Only music playback and navigation controls should remain. When DSR goes high, all features should be re-enabled.

      Make sense?
      Attached Files
      2004 4runner

      Comment


      • #4
        I want to automatically show the image from the rear-view cam when my car is put in reverse.. Can I do that with this schematic? Just tap into reverse-lights? And if so, how would I do it?

        Comment


        • #5
          That should work just fine.

          By using the parallell port instead we could dispose of the relays.

          A couple of resistors would be enough I think.
          EPIA CL-6000E mobo powered by 12V 55W PSU
          Creative Audigy 2 NX
          Samsung 152V 15" LCD panel (VGA, 1024x768)

          Comment


          • #6
            Thank you for the response.. But how would i wire this to the serial port?

            Comment


            • #7
              Originally posted by FetLyd
              I want to automatically show the image from the rear-view cam when my car is put in reverse.. Can I do that with this schematic? Just tap into reverse-lights? And if so, how would I do it?
              Sure, the circuit could be the triggering mechansim for your camera. Wire the reverse lights up to one side of the coil. Wire the other side of the coil to ground. Write a few lines of code to set DTR high and RTS low. When the software sees DSR go high, it should switch to your camera view. When DSR goes low, it should switch back to normal view.
              2004 4runner

              Comment


              • #8
                Originally posted by bsc
                That should work just fine.

                By using the parallell port instead we could dispose of the relays.

                A couple of resistors would be enough I think.
                The parallel port uses TTL logic levels (+5V, 0V). You might be able to use a resistor divider network to get down to the required +5v. Since many RS232 implementations except 0V as a logic low anyhow, you can probably do the same thing on the serial port. Either way, you'd be forgoing the isolation protection that a $3 relay buys you. The circuit I provided is simple AND safe and can be built with whatever relay is appropriate for the voltage levels you're triggering on.

                Also, one of the nice things about the serial solution is the availability of USB to RS232 adapters that are 100% compatible with native COM ports. Since most of us already have USB cables run around our cars/trucks, this could reduce the need for running any additional wires. There are also USB to Centronix devices around but I've read that those are not implemented as standard bidirectional parallel ports (dunno if that's true or not).
                2004 4runner

                Comment


                • #9
                  Rando, that is the exactly solution I was thinking before. I don't trust my car voltage sending to the computer serial or parallel port thru couple resistors. A relay is much safer. Now we need software solution.
                  2004 Matrix XR A7N8X-VM/400 AMD XP-M 2500+, DS-ATX
                  89 Supra Turbo P3 [email protected]/Abit BE6 II, Alpine M-BUS Car2PC.
                  Y2K Accord Dell GX150
                  RoadRunner is the best FE PERIOD
                  EmoRebellion is a SCAMMER

                  Comment


                  • #10
                    Ask and ye shall receive.

                    The attached archive includes source and binary of a simple demo in VB.NET based on a public domain RS232 class. Hook up the circuit to an available COM port. Run the software. Set the COM port your using and click the Open button. The CD,DSR,CTS, and RI radio buttons will turn black when their corresponding input is selected and turn white when it's not.

                    You can use the DTR,RTS check boxes to initialize the RS232 outputs however you want. The default settings is DTR high and RTS low. This corresponds with the circuit I provided.
                    Attached Files
                    2004 4runner

                    Comment


                    • #11
                      The software above will work but the radio button display will be wrong if you try to use two inputs at the same time. Sorry I just threw this together real quick to show how the circuit works.
                      2004 4runner

                      Comment


                      • #12
                        I have written a shutdown controller based on shorting pin 4 with 8 on the serial port, have a look here:

                        http://www.mp3car.com/vbulletin/showthread.php?t=27018

                        Comment


                        • #13
                          FetLyd, were you thinking more of something that will display the reverse camera without going thru the computer? If so there is a way shown in the following thread, however it requires the purchase of another $70+ gadget to get it working. I am hoping somebody will find a way to switch the Lilliput from VGA to Video1 and back using a relay, so I could just have the backup cam come on whenever I am backing up - even with the computer off.

                          http://www.mp3car.com/vbulletin/show...reverse+camera
                          "Protecting Privacy and Free Speech Online"
                          http://www.eff.org/

                          Comment


                          • #14
                            Originally posted by weekendowel
                            I have written a shutdown controller based on shorting pin 4 with 8 on the serial port, have a look here:

                            http://www.mp3car.com/vbulletin/showthread.php?t=27018
                            OK, I wasn't thinking of a shutdown controller when I posted this but none-the-less the two solutions are pretty much the same.

                            The only difference is that your circuit floats the input pin (CTS pin 8) when the relay is open. I mentioned that such an approach is possible above. Still, I think the input values are undefined when the input voltage is between -3V and +3V. I guess it's possible the inputs have pull-up or pull-down resistors installed to force them to a valid value when floating. If not, then it's possible that CTS could read either high or low while floating. Obviously a resistor could be installed to force the pull-up/down if needed.

                            The circuit here uses a DT relay so that the input line always gets a valid value.

                            In any case, the software above should work with either circuit. Hopefully a future version of FP will support this mechanism to allow enable/disable of video playback and applications while the car is in motion (required in CA).
                            2004 4runner

                            Comment


                            • #15
                              Originally posted by rando
                              I've been hoping to get a feature added to Frodo to allow it to be used legally in California. Basically I need to implement an automatic mechanism to disable certain features (video playback, applications, etc) when the vehicle is being driven.

                              Here is a simple serial port based circuit that will allow you to interface with your brake lights, ebrake switch, gear position switch or whatever you want. It only uses a single SPDT relay. Software must initialize the circuit by setting DTR high and RTS low (unless you want to use the +/-12v or +/-5v rails from your PSU). It can then read the on/off status of the relay over the DSR line. If you want the logic to work in the opposite direction, you can simply set DTR low and RTS high.

                              DTR---SWNO
                              RTS---SWNC
                              DSR---SWPole
                              Input --- Coil ---- GND or Input --- Coil --- +V depending on what you're interfacing with.

                              I've tested this with a simple vb.net program and it works great. Hopefully one of the major front ends will adopt support for it (or something similar) in a future release.

                              BTW, if you need more inputs (upto 4), you can add more relays. The SWPole lines can be hooked up to CD,CTS, and RI also.



                              So, for testing purposes, say I get a SPDT switch.
                              I hook it up like the diagram below.
                              I set DTR Low
                              I set RTS High

                              Then I can read the status of the switch by checking the state of the pole line ? Right ?
                              Attached Files
                              [H]4 Life
                              My next generation Front End is right on schedule.
                              It will be done sometime in the next generation.
                              I'm a lesbian too.
                              I am for hire!

                              Comment

                              Working...
                              X