0
\$\begingroup\$

I'm trying to find a way to connect a temperature and humidity sensor DHT22 to an XBee's RX/TX pins without an additional microcontroller(Arduino or anything that needs software) or reprogramming the XBee

Disclaimer: I do software by day, noob in electronics.

I started out this wireless sensor project thinking it would be easy to skip the microcontroller but I'm now thinking it would be hard to do that without creating an unreasonably big board.

Yes, I already know that I can do it with Arduino/PIC etc. I already know I can do that with some crazy set of timers, shift registers etc.

What I'm looking for is a hack that uses the minimum number of elements.

To direct your thinking this I what I tried: I tied the Data of DHT22 to RX of the XBee to the through a diode and to TX straight up, the idea being the RX wouldn't be bothered when the DHT is transmitting. Then I set the serial settings to 115Kbit/s, hoping that I could use use this as a 1-bit oscilloscope: instead of the 40 bits that DHT transmits I'd get 4800 bits on the other end, roughly scanning the level of the DHT Data:

0000001110000001111111111000000.....

... and I would trigger the DHT by sending 11111100 or some other sequence that has 6 '1's.

I couldn't get this setup to work so I'm curious if there's a way to make it work. Any other approach I can use? Again: I'm looking only for a reliable, simple and easy to execute solutions.

\$\endgroup\$
  • \$\begingroup\$ Have you ever seen a UART used in this way before? \$\endgroup\$ – Dejvid_no1 Apr 30 '14 at 7:06
  • \$\begingroup\$ @Dejvid_no1 no, I have not. But I've seen an IR transmitter used in a similar manner where the output frequency is divided by 3 by tripling the output bits \$\endgroup\$ – Sten Petrov Apr 30 '14 at 14:28
  • \$\begingroup\$ Ok, but this sensor seem to have some sort of timing and level controlled state machine. It just seem like a very daunting task to get this to work. And for what? Keeping the price down or the footprint? \$\endgroup\$ – Dejvid_no1 Apr 30 '14 at 14:56
  • \$\begingroup\$ The footprint.... and the challenge :) And if I could spare myself having to reprogram an XBee that would be great. \$\endgroup\$ – Sten Petrov Apr 30 '14 at 15:18
  • \$\begingroup\$ I don't see why this wouldn't work if you choose a high enough 'sample rate'. Assuming 25us minimum pulse, you need to sample at at least double that, so 100kbaud or so or higher. You also need to make sure the serial protocol on the Xbee is set up without start, stop and parity bits - is that the case? \$\endgroup\$ – RJR May 3 '14 at 5:50
2
+50
\$\begingroup\$

I think you are out of luck. From the Xbee datasheet I understand the device requires a start and stop bit on de serial port. I expect no data would be recognised/transmitted without these. Although you can configure baud rate and parity (including none), there isn't an option to disable start and stop bits.

\$\endgroup\$
  • \$\begingroup\$ What's the easiest way to superimpose stop/start bits? What comes to my mind requires counters etc, is there a single chip that can do that? Or one that can translate the plain stream to one with stop/start bits? \$\endgroup\$ – Sten Petrov May 4 '14 at 2:28
  • \$\begingroup\$ to be honest - the simples way would be something like a ATTiny microcontroller - however, if you go that way, you might just as well use it to interpret the sensor's signals and send them to the XBee over 'real' serial. You can't really 'fake' the start and stop bit because the signals coming from the sensor aren't actually 8-bit serial. \$\endgroup\$ – RJR May 4 '14 at 3:46
  • \$\begingroup\$ I figured the start/stop bits are problematic because the data is accepted only if the stop bit is detected. Adding a microcontroller fails the challenge part, I've already figured I can do that ;) \$\endgroup\$ – Sten Petrov May 4 '14 at 4:34
  • \$\begingroup\$ As I said in my answer, I don't see a realistic way to do this without a micro controller. I guess you could go all 74xxx logic with buffers, clock recovery etc. to 'packetise' every 8 bit with a start and stop bit but that'd be far from trivial. Possible setup: use a 8 bit serial-parallel buffer to feed a 10-bit parallel-serial buffer with bit 0 and 9 set to match start/stop. Recover the clock to drive both and use a counter to drive latch and enable pins. \$\endgroup\$ – RJR May 4 '14 at 6:18
1
\$\begingroup\$

Although your post does specify no micro-controllers, unfortunately I believe that what you're describing cannot be done without one. I would recommend something really small and cheap like an ATtiny25 just to do the tiny amount of bit bashing you need. Good luck.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.