Trouble using SHIFTOUT over 10ft cable
michael75
Posts: 3
I have placed a DS1620 temperature sensor in a sealed capsule and connected the nessesary pins to talk to a BS2 board to a 10ft CAT5 cable (the intent is its going in the pool, but thats not important). I have another temperature DS1620 directly on the BS2 breadboard and working, but it seems the one connected to the cable is not give believable results. I have checked over the wiring and the coding to look for mistakes, but i think its just having trouble communicating data over the length.
Can I slow down the SHIFTOUT clock rate somehow in hope of getting a better signal or is 10ft just too far?
Thanks,
-Mike.
Can I slow down the SHIFTOUT clock rate somehow in hope of getting a better signal or is 10ft just too far?
Thanks,
-Mike.
Comments
I recently read an application note about how to use SPI over long wires more reliably. The information in the apnote might help you.
It's on this page of the ams website. Look under "Application Notes" for "AN5000_SPI interface_v1_0". You can download the pdf from there. It shows how to add capacitors and resitors to get a better signal through the wires.
Another option would be to use a shielded cable with the shielding connected to ground on the BS2 board (I don't think the shielding should be connected to ground on the sensor end).
Have you tried having your signal wire paired with the ground wire as a twisted pair within the Cat5 cable? What about connecting all the unused wires in the Cat5 to ground? (I'm not sure if this last suggestion would help.)
If none of the above work, you could try RS-485 communication. This would require some additional chips and the sensor might need its own microcontroller to use the RS-485 chip.
Another option I can think of would be to have MAX232 chips at both ends of the wire to use RS-232 logic levels. I doubt RS-232 would work better than RS-485 though since RS-485 uses a balanced pair of wires so noise gets canceled out.
I think there are other alternatives as well, but I don't have enough experience to know what to recommend.
It seems like 10ft isn't too excessive but I have a barcode reader that outputs a 5V TTL signal at 2400 baud and my uC can't read the signal if the line is longer than about 6ft.
Hey, I just noticed. This is post #1 for you. Welcome to the forum. I hope you keep us updated on your project.
-Phil
Hi Mike - welcome to the Forum!
I'd suggest something like:
http://cds.linear.com/docs/Datasheet/491fa.pdf
Going the differential method allows both increased drive capability and noise immunity.
I'm looking to do the same thing in a product where the "brain" could be multi-tens of feet from the "controller".
The BS2 Stamp SHIFTOUT has a bit period of 60µs, 16.67 kHz. Even with 1000Ω source resistance, the line delay due to cable capacitance (~350pF) would be less than a microsecond, so that should not be an issue. For the BASIC Stamp SHIFTOUT and SHIFTIN commands, the line is actively driven both high and low.
That approximate capacitance is what has me worried about the DS1620 being reliable.
http://pdfserv.maxim-ic.com/en/ds/DS1620.pdf
There's note #10 on page 12 muttering about "50pF load capacitance". There's no mention if that was the test criteria or an actual specification. And there's no max capacitance load spec in either the DC or AC sections.
I'm guessing that this part was never intended to be hangin' out by 10 feet.
What it is saying is, with a 50pF capacitor loading the DS1620 data line, there is a maximum of 150 nanoseconds of delay from the high to low clock edge to the point at which the data output from the DS1620 is valid. Don't read the data during that 150ns. Extrapolating, the delay with a 350pF capacitor would be on the order of 1 microsecond. Not a problem with the Stamp. I don't know exactly when it reads the data line after the clock pulse, but I'd guess it is something like 40 or 50 microseconds into its SHIFTIN clock period of 60 microseconds, plenty of time for the data line to stabilize.
Not meant to be hanging out on the end of a cable, yes to that, but even more so for i2c and one-wire with their passive pullup resistors. People have those hang out all the time, and the time slots for one-wire are also around 60µs.
...um, I guess I didn't express my thought correctly. Yes, I see what you are saying.
I was attempting to express my concern that the DS1620 could even drive the capacitance of the 10 foot cable. Granted, the data sheet say 4mA for Iol and 1mA for Ioh, but I don't see that as being enough. I guess if it works, it works. But I'd rather scope the circuit with cable included and check the data edges coming from the DS1620 to make sure they are meeting the Stamps input requirements. I'm not too concerned with the Stamp-to-DS1620 end of things as it has 20mA drive capability.
Then again, is there a better chip to use than a DS1620 for this kind of application?
I see I suggested the capacitor there too, 4.7µF or 10µF, also that the chip be accessed in single-shot rather than continuous mode.
My suggestion of the extra capacitor comes from working with a company that was installing the DS1620 in a vending machine, out 3 or 4 feet from the microcontroller. It was the 10µF bypass capacitor that did the trick in that case.
-Phil
If there is crosstalk from transitions on the data line, via the cable capacitance shown as blue, then it could induce glitches on the clock line and the RC filter could remove them at the DS1620. The cable wiring would make a great difference. The worst thing would be to run the clock and data together on one twisted pair. Better would be to run them each on a separate pair, as far apart as possible. Say clock paired with Vss and data paired with Vdd, along with a capacitor from Vdd to Vss at the DS1620. Ground all unused pairs in the CAT5. That makes the capacitance from the clock line to ground larger than the capacitance from data to clock, so the effect of the coupling is less. Even add just 100 pF from clock to ground at the DS1620 to help absorb the glitch. And/or 100pF on the data line to temper its slew rate.
Here's the schematic for the DS1620DK board, with the signal order as it appears on the modular cable:
-Phil
Anyway, thanks for all the help. I wasn't expecting so many thought-out responses in just a week!
-mike
Well, that "thieving"(sp?) power technique is very clever!
Did by any chance you measure/scope Vdd to see what was actually there?
Curious in San Jose.
This forum is not want for thoughts!
Glad to hear you have something working.