What is the difference between the 74HCT245 and sparkfun's logic level converter?

The NXS0108-Q100 is open drain 3.3 to 5 volt Translator so can this be used for sensor communication to a Teensy 4.1.


The answer really depends on how your sensor communicates with Teensy. Many different types of sensors exist. Nobody can give you a simple answer which applies to all types.

For I2C communication, the mosfet+resistors is good. Other open drain ways might work well, if appropriate pullup resistor are used.

For SPI, usually unidirectional buffers are best, and if high clock speeds are used the propagation delay in the buffers can matter.
 
So my original question need clarifying. The NXS0108-Q100 is open drain 3.3 to 5 volt Translator so can this be used for sensor communication to a Teensy 4.1. I am stuck in my design because of this. Any thoughts will be appreciated. And "NO" not any 245 can be used in this situation.

Regards,
Marathonman

For anyone to help you, I think you need to expose what sensor is on the other side. Hard to tell what might work with no pertinent details. JMHO.
 
Auto direction sensing level shifters may have issues when used with unidirectional signals, like UART, SPI/QSPI, and 8080-style parallel buses. (In particular, the low level tends to have "steps" depending on what the auto-sensing circuitry does, with associated delays in reacting to the signal.)

I've happily used SN74LVC1T45 (single; SN74LVC2T45 for dual and SN74LVC8T245 for octal) for 1.8V UART (Odroid-HC1) to Teensy (LC, 3.2, and 4.0, all 3.3V), but am now switching to TXU0202 (DCU, 2.3mm×2.0mm with 0.5mm pitch) since it is fast (up to 200 Mbit/s at 3.3V-5V), supports either side with any voltage levels from 1.1V to 5.5V, and is fixed direction (no direction selection pin): one in each direction.

Similarly, I have a few TXU0304 to play with for SPI logic level translation, with same specs: three pins in one direction (CS, CLK, DO), one in the other (DI).

For an 8-bit 8080-style parallel bus, where you need a single pin to control the direction of all 8 signals, I would use SN74LVC8T245; Mouser has a few varieties in stock (lots of TI SN74LVC8T245QPWRQ1 or automotive-qualified in particular). Either side can have a Vcc between 1.65 and 5.5V. There is a single DIR pin, referenced to the A side, which controls which side is output; and a single /OE pin (active low), which enables output. When both are low, A side are outputs; when DIR is high and /OE low, B side are outputs; otherwise you want both DIR and /OE high so that both sides are tristated (high impendance). Each channel is slightly slower than 74LVC1T45 –– at 3.3V or 5V, high-low transition can take up to 10ns compared to the 5ns or less; but still, each channel should easily handle 50 Mbit/s, which makes it a good choice for e.g. parallel display bus (ILI9341 et cetera) voltage level conversion.

If the eight pins involve either GPIO, UART, SPI, or similar buses –– and not I2C or one-wire or two-wire, where both sides can drive the data line (low) at any point ––, but are separate, then I would just use eight 74LVC1T45 chips in SOT-23; Mouser does have the Nexperia ones in X2SON6 (1mm × 1.5mm, 6 pads, 0.5 mm pitch) or XSON6 available.

Generally, instead of "sensors", I would consider the buses used, and select the logic level translation based on that. I would use bidirectional (auto direction sensing) ones only with I2C, two-wire, and one-wire sensors, where either end can drive the line low simultaneously –– but only those whose datasheets explicitly mention that they work for I2C!; and fixed unidirectional ones for UART and SPI buses. For GPIO, I'd use 74LVC1T45, using pin pair for each (one for data, one for direction), plus one additional common pin across all for /OE (output enable, active low), with a pull-up resistor, so that outputs will stay tri-stated until my own code enables them.
 
Thank all of you for your answers, I didn't realize it was so critical, so then I have to do some serious planning on exactly what type of sensors need. Now i realize why BriComp got frustrated and left the my thread but I guess it is to late for that.
SO where is the best place to get temp, current and voltage sensors

Regards,
Marathonman
 
TXU0202 can not be used for Analog which is what i need level translator 5 to 3.3v for because of the Schmitt trigger input.

Yes my power to the sensors are 5 volts and the Teensy of course 3.3v using Analog sensors.
 
TXU0202 can not be used for Analog
Of course not, it is a logic level shifter, not an analog device.

i need level translator 5 to 3.3v [for analog signals]
Use a voltage divider with the upper resistor a bit over half of the lower resistor; optimal is about 9:16. This scales the voltage by 9/16, so that 5V is scaled to 5V×9/16 = 3.2V. The exact resistance depends on what you are measuring, and how much current can the source provide. Too high a resistance, and the Teensy ADC cannot sample it well. Too small a resistance, and the voltage level drops (because the source cannot provide enough current).

I have used rail-to-rail operational amplifier (RRIO opamp) to buffer the input voltage. It is powered from the higher (5V) voltage. There is very little current flowing into the opamp inputs, and the source only needs to provide minuscule currents. Adding a small resistor to the input can reduce noise, while increasing the current draw a bit, though. The voltage divider is then between the opamp output and Teensy ADC pin. For example, if you use 470 Ohm (upper, between source and Teensy analog input) and 680 Ohm resistors (lower, between teensy analog input and ground), both 0.1% precision for 10-bit, the opamp (or sensor) needs to source at most 5/(470+680)≃0.0043478A≃4.3mA (most opamps can provide 10mA per channel or more, so this seems to me like a good tradeoff, but others may have better advice for this), and 5V will be scaled to 5V×680/(470+680)≃2.96V. Looking at what Mouser has in stock right now, I'd pick TI LMP7731MF (datasheet, in SOT-23 footprint), but I'm just a hobbyist who likes to interface his Teensies to various sensors myself.

Another option is to use an external ADC, for example the ubiquitous ADS1115 (that you can find breakout boards for at eBay and elsewhere), that you power from the 5V, and then use the logic level shifter between the ADC and the Teensy.

Instead of a logic level shifter, you can even use an isolator, so that your analog "front end" can use its own stabilized (isolated) supply and ground –– I know of designs that have used batteries for a low-noise cheap isolated supply! For isolated use, I recommend an ADC that uses the SPI bus and a Si8641 isolator (since Si8641BC-B-IS1R is still available at Mouser for under $5 USD apiece). Si8641 works similarly to TXU0304, in that both can be used as SPI bus logic level shifting, but the Si8641 isolates the two sides, so that nothing, not even the grounds at either side, are directly electrically connected across the isolator.
 
Darn I don't have the board space for all those resistors. What would you recommend with the two pictures posted is all the space i have. So i can add the ADS1115 to what i have now NXS0108PW-Q100J and be fine???
Solar Traacker Daughter Board Front.PNG
Solar Traacker Daughter Board Back.PNG
Thank you in advance and sorry OP for the disruption.
EDIT; I have multiple sensors so the ADS1115 is not going to work as it had four inputs and one output.

Regards,
Marargonman
 
Last edited:
I think you have plenty of room for the resistors, even in 0805 size (although I'd use a footprint that works for both 0805 and 0603 resistors):
analog-input-divider.png
where the GND pins are attached on the other side. You might even consider having a current-limiting resistor between the 5V and the 5V pin for each sensor. (It can be omitted by bridging, or by using 0 Ohm resistor.)

If you are worried about shorting, you can put kapton tape over the components as insulation.

You even have enough room for two OPA4345UA or TLV2747 quad precision op-amps, for buffering each of the eight analog inputs, so that the analog sensor output does not need to provide much current at all. In that case, the two quad opamps would be between the pins and the voltage divider resistors, and driven from the 5V supply. I recommend this, because analog sensors usually cannot provide much current (and when they try, the result is skewed).

If you want, I can sketch something in EasyEda for you to examine –– but remember, I too am just a hobbyist, with a background in software; not an EE.
 
I just realized i can use the TMP 36 Low Voltage Temperature Sensors directly to a Teensy. Even though it is powered by 5 volts the output is from 100-2000 mV which even with the 500mV offset I am still within the Teensy output of 3.3 volts.

I would appreciate that so much and thank you. Maybe just a circuit diagram would be useful.

PS. This breakout board connects to the Teensy which is mounted to the main duel H bridge board that supplies all the 5 volts IC's @ 3 amp. The top left pin of the Teensy side ( Bottom View) is the 5 volt and ground pins.
 
Last edited:
Why aren't you using digital temperature sensors like DS18B20, LM75, TMP75, or TMP126? They could be run directly off 3.3V, no level shifting needed.

TMP126 in particular are cheap but good: TMP126N costs 1.59€ per sensor in lots of ten at Mouser, with operational range -40°C to +150°C; TMP126 costs 2.33€ per sensor in lots of ten at Mouser, with operational range -55°C to +175°C. Both have 0.25°C accuracy, and 0.03125°C resolution. The package is SC-70-6, 2mm×1.25mm with 0.65mm spacing; small, but possible to solder by hand. (You should add a 0.1µF=100nF bypass capacitor between Vcc and GND at the sensor, as close to the pins as possible; I personally like X7R in 0603 size for this.)
These use SPI, but with a single data line. On the Teensy, you put a 10kOhm resistor between MOSI/PICO and the data line, and connect MISO/POCI directly to the data line. The data line and clock are shared by all TMP126/TMP126N's, as are Vcc (3.3V) and GND. You additionally use one or two GPIO pins per TMP126/TMP126N: a chip select (active low) output, and optionally an alert (active low) input. So, minimally you use 8 GPIO pins (as chip selects) and three SPI pins (SCK, MISO, MOSI) on the Teensy. No level shifting. You can reduce the GPIO pin count further by using a serial to parallel latch, counter, decoder, say MC74HC138A, since at most one of the chip select pins is low at any time. (With MC74HC138A, A0, A1, A2 are connected to teensy GPIO output pins, CS1 and VCC to 3.3V, ground, CS2 and CS3 to a fourth Teensy GPIO pin as a select pin, and Y0 through Y7 as the TMP126/TMP126N chip selects. You then need just four GPIO pins, MOSI/PICO, MISO/POCI, and clock pin on the Teensy.) You can expand further by adding chip select pins (or another MC74HC138A, with CS2 and CS3 to a fifth Teensy GPIO pin and Y0 through Y7 as new chip selects, and A0, A1, A2 to the Teensy GPIO output pins).

Anyway, I sketched out an example schematic and a 44mm×39mm example board for eight analog inputs, buffered using two OPA4345UA opamps (available at Mouser): 8-channel-buffered-analog-input.

Using the silkscreen labels, V can be 2.5V to 5.5V. The maximum voltage on the right side outputs is V×R2/(R1+R2), and the current draw (on the opamp channel) is V/(R1+R2). With R1=470 and R2=680, maximum output is 59.1% of V, and maximum current draw is V/1150; at V=5V, those are 2.96V and 4.3mA, respectively. You can use larger resistor values to reduce the current.

R3 are optional current-limiting resistors for the analog sensor, if it needs a voltage supply. The bottom layer is almost all ground; there is one short Vcc across each OPA4345UA chip.
 
I appreciate all the help, all i wanted was something simple but all this did was open a huge can of worms. I have only been researching temp sensors for a week so i had no idea and have never used them. Total sensor count would be three temp sensors maybe four and a voltage sensor of the battery connected to the solar tracker. I also have never heard of PICO or PICI anywhere in the Arduino community so I have no clue what those stand for.
I would like to have the least amount of parts on the board so some sole searching is in order but I think the digital is the way to go. Seems that this will take a lot of Teensy pins so i will list available pins.

EDIT; OH I see it is SPI but some clowns decided to change the naming structure from MOSI and MISO.
EDIT; Okay I have a lot of pins available like 30 so all is good.
 
Last edited:
Minimum part count with this device and two meter two wire capable with reduced code control complexity. What do you think?
LMMT01 Daisy Chain.PNG
 
2 meters of wire connected directly to a GPIO pin with a "no extra parts" design philosophy is a recipe for a product which seems to work at first but fails prematurely when installed in a less than ideal environment (strong radio signals, electro-static discharge, etc).
 
"The LMT01-Q1’s pulse count interface is designed to directly interface with a GPIO or comparator input, thereby simplifying hardware implementation. Similarly, the LMT01-Q1's integrated EMI suppression and simple 2-pin architecture makes it suitable for onboard and offboard temperature sensing in a noisy environment. The LMT01-Q1 device can be easily converted into a two-wire temperature probe with a wire length up to two meters."

I am sure with minimal parts the emi suppression can be controlled or isolated. Also a shielded two conductor wire can be had also. This is an automotive part so it is made for harsh environments.
 
Here is a pic of the LM101 according to the manufacture it can be used up to two meters. This is of course the demo board from them and it could be significantly different in real world scenarios but yet according to them it can be done. As you plainly see the sensor itself is on a two meter length of wire which can be used off board in tight spots like located on a battery box or other area's ect...ect. Also it can operate at 3.3 volts which means no lever translating, Yea!.

LMT on wire for testing.PNG

If anyone has used this temp sensor i would really appreciate some input and thanks in advance.
Regards,
Marathonman
 
@ PaulStoffregen ; So do you think I should use the one wire DS18S20 that you had in your example. Any such help would be helpful, these easier and less complex the better.

Regards,
Marathonman
 
2 meters cable is pushing the Dallas/Maxim 1-wire protocol pretty far. Many people have made it work, usually with 1K or 2.2K pullup resistor rather than the usual 4.7K.

I haven't used LM101 and I know nothing about it. Tried a quick search but only ended up at this TI opamp page (but I do recall using a LM301 opamp in the 1990s, when I had a special need for adding an extra compensation capacitor to make a complicated feedback loop run stable).
 
Last edited:
It's the LMT01, not LM101 and here is the datasheet.

It outputs current pulses corresponding to temperature, so needs a current to voltage translation using a resistor and probably a transistor or other level shifter to get it up to 3.3V and then you have to count the pulses. Wouldn't be my first choice.

I'd personally stay away from analog sensors going any distance using wiring as they are susceptible to noise pickup in my experience.

Nice thing about the DS18B20 is that it has good library support and is open collector output so can be pulled to 3.3V and interface directly to the Teensy. I think 6' will be OK, as Paul mentioned just use a little stiffer pullup resistor rather than the standard 4.7K and run 5V to it for power. Don't try to use parasitic power mode which lets you run 2 wires instead of 3.

BTW, that TMP126 looks like a really nice device, but it runs over SPI, so going any distance might be a challenge. Probably doesn't have any library support either, so a little harder to program. I'll definitely keep it in mind for my own projects.
 
I have used an AD590 in the past over many, many feet (20 I seem to remember). It's not cheap but is an excellent device.

In one of my installations, I also picked up mains hum, which I used to my advantage, taking readings (8 I seem to remember) equally spaced over one mains cycle and average the results.

If you do this, it is IMPERATIVE that you average equispaced over exactly 1 mains cycle. If you don't the readings will CYCLE around the mains cycle, i.e. your readings will have a sinusoidal error.

This gives the effect of increasing the resolution of the A/D. I was using an 8bit A/D I2C at the time.

Here is a pic of the LM101 according to the manufacture it can be used up to two meters.
By the way if you did NOT mean the LM101 why did you say that?
 
Yes!, it was a typo and yes typo's do happen BriComp with big fat fingers lol! LMT01 is correct. Thank you all for the input @PaulStoffregen @KenHahn @BriComp.
I will be testing both since the LMT01 which is made for harsh environments and the DS18B20 is tried and true both will very little external parts needed. I will check the AD590 and see if it will fit into my scenario. Premade DS18B20's in stainless steel tubs are a very attractive offer though yet tests will reveal all.

I am just being cautious but would it be a good idea to add ESD protection on this long line?? Also with the amount of clock cycles needed I am wondering if I should implement an UART one wire setup to reduce the load on the MCU as I will have a substantial code doing many things.???????

Thanks again,
Marathonman
 
Last edited:
The AD590 has a minimum voltage of 4 volts so that means I would have to have a translator in which i do not want to do. I am wanting to stay within the 3.3v Teensy range.

Maxim › Design Resources › Technical Documents › Tutorials › 214 TUTORIALS 214. USING A UART TO IMPLEMENT A 1-WIRE BUS MASTER.
The document is pretty good but I have been searching on forums to find any implementation. I like the fact that I can relieve the MCU of clock cycles associated with the use of one bus and the fact that the UART had send and receive buffers associated with it which can then be written into a struct.

I think a lot of people could benefit from this approach that has their Teensy loaded down with other things like motor control and displays.
Regards,
Marathonman
 
The AD590 has a minimum voltage of 4 volts so that means I would have to have a translator in which i do not want to do. I am wanting to stay within the 3.3v Teensy range.
You obviously didn't read or understand the data sheet correctly.

The transducer gives an output of 1uA/deg K.
At 30 Deg C that would be 303 uA. Putting that across a 10k resistor would give an output of 3.03V.
0 Deg C would give an output of 2.73V.

....and, actually I remembered wrong, it was an AD592 that I used but that has the same output.
 
[You obviously didn't read or understand the data sheet correctly

Is there ever a time you don't reply with a snide remark. Yes I did READ the data sheet and yes I must have overlooked that, Sorry I am not perfect. You know your not perfect either and make mistakes as does everyone on this planet thank you sir. Besides the fact the crazy sensor must be gold lined as it has one hell of a price and to much for me as I need four when i can get 5 DS18B20's in SS tubes for the price on one AD592.

Seems the usage of these types of sensors take a lot of CPU/MCU cycles. I have a lot of other code and as such could use a little off loading in this area not to mention the delays which will screw up other code loop. The use of UART to drive these are very compelling reducing the load on the CPU/MCU. I am wondering if anyone has used this scenario for one wire sensors. I have found plenty of references to UART one wire yet no code to back it up and I would not know where to begin.

I guess my question would be can the One Wire Library be modified to incorporate UART and how would I implement the necessary delays without hindering other code????

All advice will be so much welcomed.
Thank you,
Marathonman
 
Back
Top