0

I want to create a logic converter to communicate an ATtiny85 (trinket 5V) with my raspberry-pi. I am currently following this guide.

I want to use a written program for ATtiny that only generates a TX UART output on the software side and send data to the raspberry.

In this guide the NMOS BSS138 is used, I would like to know if I could use the NMOS 5LN01SP instead.

Also, I want to communicate in the simplest possible way. What is the difference if I choose to use a voltage divider (two resistors) at the ATtiny85 output to ensure the 3V on the Raspberry input pin or the fact that I lose bi-directional property?

Thank's you for your help.

Ephemeral
  • 177
  • 1
  • 12

1 Answers1

2

I want to use a written program for ATtiny that only generates a TX UART output on the software side and send data to the raspberry.

I need 9600 baud

In this situation a resistive voltage divider should work fine; in fact with decently chosen resistors (say 1.2K series and 2.2K shunt) it will deliver a better signal than most off-the-shelf implementations of a series MOSFET shifter which tend to use a 10K pullup resistor.

Another option could be to run your ATtiny at 3v3 itself; however if you do that it is better to give it its own 5v to 3v3 voltage regulator, as even inadvertently connecting or disconnecting loads (especially anything that may have its own supply filter capacitor) from the pi's delicate 3v3 pin tends to cause system failures.

Chris Stratton
  • 33,491
  • 3
  • 44
  • 90
  • Thank you very much for your time and your explanations. I had thought to feed my trinket 3.3V but the trinket is given for 5V (USB or battery). If I follow your second option, it would mean that I have to feed in 5V for example this regulator that I have on hand LD1117 then feed my trinket with the output of the regulator and I would then 3.3V output on the pins? – Ephemeral Aug 03 '19 at 18:06
  • That depends a bit on why you are using a Trinket board in the first place; if you are using one why aren't you using the USB? The Trinket board is available in both 5v and 3v3 versions, the USB will probably only work if using the version actually designed for that voltage. Otherwise you'd be better off with a bare ATtiny which you could indeed setup to run from 3v3 with an LDO and associated bypass capacitors. With what you have on hand and can probably scrounge up, a resistive divider is likely your simplest path forwards. – Chris Stratton Aug 03 '19 at 18:09
  • Thank you again. I program my trinket with USB. Then I intend to use the input pins of the trinket to feed it with the help of the output 5V or 3.3V of the raspberry by putting it on a breadboard to start. Yes I could use a bare ATtiny but for the moment I'm just trying to implement Software ("bit-bang") UART Transmitter software side and receive data raspberry side. – Ephemeral Aug 03 '19 at 18:14
  • I do not want to use USB because the goal is to bring the project to a bare ATtiny afterwards. If I use a voltage divider with resistors, this resistors must have a low tolerance ? – Ephemeral Aug 03 '19 at 18:17
  • No, resistor tolerances aren't particularly critical. If you are concerned, calculate a divider ratio closer to 3v and try to keep it above say 2.7v, but in actuality slight overvoltage is typically within spec anyway. – Chris Stratton Aug 03 '19 at 18:50
  • Thank you very much. – Ephemeral Aug 03 '19 at 18:53