5
\$\begingroup\$

Okay guys, I'm in a bit of a pickle here. I have the following circuit:

Schematic

As you can see, pin 3 is my only output. I've actually already had this board printed, so there's not much room for modification. I'm taking a reading from an analog pressure sensor, doing an A/D conversion and then I want to send that value to an Arduino. Is there ANY way I can send this over just pin 3? If so, how? If not, can someone give me a quick SPI or Bit Bang code example? I'm using a PIC12F675.

Edit: Here's a link to the full size image.

\$\endgroup\$
  • \$\begingroup\$ Why can't the pressure sensor be plugged straight in to the arduino? Would make life easier. \$\endgroup\$ – Dean Apr 22 '13 at 0:18
  • \$\begingroup\$ Well, the Arduino will be doing some other things in parallel, so it was just easier to split it up into 2 separate applications. \$\endgroup\$ – Willem Ellis Apr 22 '13 at 0:20
  • \$\begingroup\$ do you need bi-directional communication? if you just need to send data one way UART setup would work \$\endgroup\$ – Gorloth Apr 22 '13 at 0:24
  • \$\begingroup\$ Yeah. I just need to send data from the sensor board to the arduino. Can you link me to a reference for that? \$\endgroup\$ – Willem Ellis Apr 22 '13 at 0:25
  • \$\begingroup\$ @WillemEllis - I am still wondering why you couldn't plug the sensor into the Arduino as Dean suggested. Reading the sensor directly could take less effort than reading data about the sensor from any sort of communication scheme. It could be entirely interrupt driven and auto triggered, or only triggered when you need a reading. Either way, Using UART (TX from the PIC to RX on the Arduino) is the best thing imaginable for simple 1 wire communication, as AngelAtLarge points out in his answer. I don't know anything about PIC, and I don't use Arduino, so I can't help with the code. \$\endgroup\$ – Kurt E. Clothier Apr 22 '13 at 1:16
9
\$\begingroup\$

I am not a PIC person, but normally for serial standard you need three lines:

  • Send (TX)
  • Receive (RX)
  • Ground (GND)

Since you dont need RX, you could use the circuit ground and use pin 3 for TX, if your Arduino and your PIC agree on the baud rate, and other parameters related to serial comms (stop bits, parity bits, etc). This in theory could be standard serial comms if you can get your PIC to do it.

SPI is not going to be possible, since SPI requires an independent clock line.

Another thing to consider would be Dallas 1-wire protocol, however, in practice it will be tougher to implement than either real or hacked serial.

\$\endgroup\$
  • \$\begingroup\$ Thanks for this! I've been reading about possibly using serial. Will update on how it goes \$\endgroup\$ – Willem Ellis Apr 22 '13 at 0:47
  • 1
    \$\begingroup\$ I wish I could do a -1 for not being a PIC person, but that wouldn't be fair so I upvoted instead ;) \$\endgroup\$ – user17592 Apr 22 '13 at 21:18
  • \$\begingroup\$ I have nothing more to say \$\endgroup\$ – angelatlarge Apr 22 '13 at 21:25
  • \$\begingroup\$ So this is actually the answer. I did it using UART bit banging. You can find my code here. It's pretty self-explanatory. Since I only needed to Tx, I only needed one line. \$\endgroup\$ – Willem Ellis Apr 23 '13 at 16:16

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.