Digital Input cable
Digital Input with long cable - flickering values
The excess cable is most likely picking up EMI and creating spurious pulses on the input. There are two basic ways of combating this:
- Increase the drive strength (especially the sink capacity) of the output
- Implement a balanced line communication system
You can combine both those quite easily, whilst at the same time boosting the output voltage to 5V using a 74HCT04 hex inverter chip (make sure it's the HCT variant). Powered from 5V it will boost the logic level from 3.3V to 5V, and it will have a greater drive strength than the PIR chip alone.
Then the trick is to use multiple gates in the right way to make a crude balanced line system:
Basically you're double-inverting the signal so it remains the same logic level (high = high, low = low) but has higher drive strength, and you're also single-inverting the signal so it has inverted logic (high = low, low = high). You then connect those to two different IO pins on the Arduino. Read both pins (instead of just one) and as long as the signal are opposite (Q = HIGH and !Q == LOW) then you have a valid signal. If both signals are HIGH then you have noise and you can ignore it.
You also need to ensure you select the right kind of cable. Ideally you need a cable with at least one twisted pair in it so that the Q and !Q signals are twined around each other. This ensures that if EMI is induced into the wire it's induced into both signals equally. CAT5 Ethernet cable is often quite a good choice.
Source: arduino.stackexchange.com
DBTech Digital to Analog Audio Converter with Digital Optical Toslink and S/PDIF Coaxial Inputs and Analog RCA and AUX 3.5mm (Headphone) Outputs - 6 foot Heavy Duty Optical Toslink Cable with Gold Plated Connector Tips Included (Colors May Vary - Black or White)
Speakers (DBTech)
- Converts the digital audio signals from any television, DVD player, multi media player, gaming console or sound system that has a coaxial or optical toslink digital...
- Inputs are Coaxial S/PDIF or Optical Toslink digital, and outputs are analog RCA right & left or AUX 3.5mm output jack. Latest High Tech design, that provides...
- Simple and easy to connect and requires no operating skills. Extremely small and compact, yet very durable with strong metal body, can be placed anywhere close to...
- Compatible with televisions, HDTV, DVD Players, Gaming Consoles and Sound Systems that have Coaxial S/PDIF or Optical Toslink Digital Outputs and Compatible with...
- Includes 6 foot Fiber Optic, Extra Durable OD 6.0mm Heavy Duty Toslink Optical Cable with Gold Plated Connector Tips. **Please note this will NOT convert Dolby.
|
DBTech Digital to Analog Audio Converter with Digital Optical Toslink and S/PDIF Coaxial Inputs and Analog RCA and AUX 3.5mm (Headphone) Outputs - 6 foot Heavy Duty Optical Toslink Cable with Gold Plated Connector Tips Included (Colors May Vary - Black or White)
Speakers (DBTech)
- Converts the digital audio signals from any television, DVD player, multi media player, gaming console or sound system that has a coaxial or optical toslink digital...
- Inputs are Coaxial S/PDIF or Optical Toslink digital, and outputs are analog RCA right & left or AUX 3.5mm output jack. Latest High Tech design, that provides...
- Simple and easy to connect and requires no operating skills. Extremely small and compact, yet very durable with strong metal body, can be placed anywhere close to...
- Compatible with televisions, HDTV, DVD Players, Gaming Consoles and Sound Systems that have Coaxial S/PDIF or Optical Toslink Digital Outputs and Compatible with...
- Includes 6 foot Fiber Optic, Extra Durable OD 6.0mm Heavy Duty Toslink Optical Cable with Gold Plated Connector Tips. **Please note this will NOT convert Dolby.
|