drumminhands

  • Joined Feb 6, 2024
  • 6 discussions
  • 32 posts
  • Yes that's doable. On the software side, the latest dev branch of the Bela core code contains example PureData/uart-communication. Make sure you update your board to the latest dev branch following the instructions here.

    Hardware-wise, if your Arduino has 3.3V signal levels, then you can connect the two directly. If your Arduino has 5V signal levels, on the other hand, you need some way of adapting that voltage to Bela's 3.3V. A dedicate logic level shifter IC would be the ideal solution, but you could toy around with a passive one, too. Remember that Bela cannot take unbound current from 5V sources into its pins, so protection is needed.

    For 5V Arduino -> 3.3V Bela you could try something like this:

    Arduino
      Tx---+
           |                  
           R1 4k7
           |          Bela
           +-----------Rx
           |
           R2 8k2
           |
          GND

    R1 and R2 is the resistor divider with gain R2/(R1+R2) and R1's high value doubles up as a current limiter. Values are not critical, but keep R1 > 1k and pick R2 so that R2/(R1+R2) * 5V is between 2.7V and 3.3V.

    Passive level shifting to go from Bela's Tx at 3.3V to Arduino's Rx at 5V is not possible, but it may be that there is no need for level shifting: the ATMEGA328p's datasheet states in table 28.2 "DC CHARACTERISTICS" that an input can be registered as HIGH if it's as low as 0.6Vcc, i.e.: 0.65 = 3.0V. So it may just work with a direct connection. However, I'd add some protection to avoid burning Bela in case the Arduino pin sends out 5V at some point, either during boot or because of a but in the fw. Put 10k in series and that should be more than enough.