I would like to send serial data at 9600 baud between a PIC and a Raspberry Pi.

Both circuits are powered by a 5V wall charger. The distance shouldn't exceed 15cm. They don't currently share a common ground, but I could change that if necessary.

Can I use a MAX232 for this? Are there other (better) options?

  • \$\begingroup\$ You need to tell us: (1) the baud or data transfer rate. (2) The distance between the devices. (3) The voltage of each device (5 V or 3.3 V). (4) Can the circuits share a common ground. You may be able to use a direct TTL connection if the distance is not too great. Put all the information into your question. Welcome to EE.SE. \$\endgroup\$ – Transistor May 18 '18 at 18:39
  • \$\begingroup\$ 1) data rate: 9600 baud. 2) well the distance is not defined but i won't use more that 15cm. 3) in rasberry and pic I use a 5v charger. 4) is a option \$\endgroup\$ – Jaime Andrés Avendaño Villa May 18 '18 at 19:13
  • \$\begingroup\$ Hi Jaime, I have edited your question to include your new information. If I have made any mistakes, please let me know! (Or you can fix them yourself by clicking on "edit" under your question) \$\endgroup\$ – bitsmack May 18 '18 at 20:10

You can use one "MAX232 type chip" at each end and have proper RS-232 levels between UARTs. The MAX232 is not suitable for 3.3V operation, but there are other similar chips (eg. MAX3232) that will work properly from 3.3V (as used by the RPi).

If your PIC is running from 3.3V and the distance is small and you have a common ground you may be able to directly (or with series resistors of a few hundred ohms) connect the "TTL" inverted serial port pins without the extra chips.

  • \$\begingroup\$ Sorry, i don't understand what you mean with inverted. I can connect the raspberry and pic using Tx and Rx inverted? I mean, Tx of the pic in Rx of Raspberry and Rx of pic in Tx of Raspberry... It's something like that? \$\endgroup\$ – Jaime Andrés Avendaño Villa May 18 '18 at 19:25
  • \$\begingroup\$ Inverted means you may need a CMOS inverter in both transmission lines. And of course, you had to connect RX to TX and vice versa. \$\endgroup\$ – Janka May 18 '18 at 20:24
  • \$\begingroup\$ The MAX232 inverts, so two will leave the signal unchanged in 'polarity'. So if you connect directly the chips will not know there are not two MAX3232 chips (for short distances) - but if you look at the signal on an oscilloscope it will appear inverted. NOTE: You should only connect directly if the PIC runs from a 3.3V supply. Otherwise you might damage the RPi. You can regulate the 5V down to 3.3 for the PIC. Rx<-Tx and vice versa, of course. \$\endgroup\$ – Spehro Pefhany May 18 '18 at 20:25
  • \$\begingroup\$ @Jaime, RS232 uses -3 to -12 as a logic 1 and +3 to +12 as logic 0. The PIC and Pi will use +5 V (or 3.3 V) as 1 and 0 V as zero. A cheap resistor interface is sometimes used to convert RS232 into logic levels but the signal has to be inverted either externally or in the code. \$\endgroup\$ – Transistor May 18 '18 at 20:40

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.