The Raspberry Pi has 3.3 V logic level and the Arduino has a 5V logic level. It is warned against connecting the Arduino TX to the Pi RX:

Pi is 3.3v and the Arduino is 5v. Connect the two and you might conjure up some magic blue smoke

I was wondering if without a logic level converter chip like the CD4050, you could use the PWM functionality of the Arduino plus a low-pass-filter to effectively produce 3.3 V TX signals that would be safe for the Pi RX to receive?

I have an Arduino Uno with an ATMega8 according to the schematic. It seems it is possible to change the frequency of the PWM pins to up to 32 kHz. I assume it's possible to use the PWM with a low-pass-filter to effect a 3.3 V and as it runs at 32 kHz this frequency would then be more than enough to support 9600 baud rate. Is this correct? I'm finding it hard to search for "Arduino send serial using PWM". The SoftwareSerial library requires any Digital IO pins so this sounds like it might not allow for using the PWM pins? I've also read SoftwareSerial library can use the Analog Input pins for output i.e. TX?

  • Why the down vote? – AJP Jun 15 '19 at 6:33

A simple voltage divider between the Arduino TX and the Pi RX should work to protect the Pi.

And thanks to Juraj's comment, it appears that the Pi's 3.3V high will be enough to trigger the Arduino and it won't need to be boosted up to nearer 5 V.

| improve this answer | |

I assume it's possible to the change the value of the voltage the PWM is producing

This is not possible. PWM cannot output an analog voltage. Instead, it rapidly switches between 5 V and 0 V.

| improve this answer | |
  • Thanks for your answer Edgar. Could put a capacitor on it to effect a smoothing to approximate 3.3 V? – AJP Jun 15 '19 at 9:07
  • 1
    A resistor in series followed by a capacitor to ground. But that would be no simpler than a voltage divider with two resistors. – Edgar Bonet Jun 15 '19 at 9:09
  • True. I wonder why people suggest a more complex route of using the logic level converter. – AJP Jun 15 '19 at 9:12

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.