logo elektroda
logo elektroda
X
logo elektroda

Which transistor/scaler? - reading data from an electronic caliper

iksrowaj 1170 29
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19246806
    iksrowaj
    Level 3  
    Dear forumers,
    I am making an interface to communicate between ESP32 and an electronic caliper which is powered by a 1.5V battery. The signals coming out of it are also 1.5V.
    I need to build a circuit (preferably on a single transistor) for the ESP to read 3.3V correctly.
    Can I use a PNP instead of an NPN so that the signal is not inverted? Which transistor should I choose? What parameters should I pay attention to?
    Thank you in advance.
    Regards
  • ADVERTISEMENT
  • #2 19246888
    pawlik118
    Level 33  
    Write more about how the communication is done, speed etc. A diagram would also be useful.
  • #3 19246932
    krzysiek_krm
    Level 40  
    The best thing to do, however, is probably a logic level converter.
  • #4 19247529
    iksrowaj
    Level 3  
    Such a Chinese one-way protocol for callipers. A clock line and a data line.
    Which transistor/scaler? - reading data from an electronic caliper .
    The shortest pulse is about 6us so about 166kHz.
    Of the converters so far I have found a TXB010*, the one on the BSS138 does not work.
  • #5 19247796
    pawlik118
    Level 33  
    clock can be divided on two resistors. The cheapest solution for the data from the caliper to the uC would be a circuit on any op amp set as a comparator with a threshold of about 1/2 of 1.5V.
  • #6 19247835
    iksrowaj
    Level 3  
    But it's the other way it's supposed to work. From 1.5 to 3.3V.
  • #7 19247845
    krzysiek_krm
    Level 40  
    iksrowaj wrote:
    But it is supposed to work the other way. From 1.5 to 3.3V.
    .
    And it will
    pawlik118 wrote:
    set as a comparator with a threshold of about 1/2 from 1.5V

    The caliper transmits in 1.5V logic, i.e. for L it is under the threshold and for H over the threshold (of the comparator).
    pawlik118 wrote:
    circuit on any op amp set as comparator
    .
    Using an op amp as a comparator is a poor idea - the amp has some things that are not needed for anything in a comparator, such as compensation.
  • #9 19247966
    krzysiek_krm
    Level 40  
    iksrowaj wrote:
    I conclude, however, to look for some converter.
    Should such a Pololu 2595 be able to do it?
    https://www.pololu.com/product/2595
    .
    From the manufacturer's description it looks like it should work, although it's not really clear what transistors they used there, if it were known you could look at the DS.
  • ADVERTISEMENT
  • #10 19247981
    iksrowaj
    Level 3  
    Which transistor/scaler? - reading data from an electronic caliper There are XBs or X8s on the transistor, I am looking but cannot find one. It's some sort of double and I'd love to know what it is, as I wouldn't want to solder off the board and solder into my project.
  • ADVERTISEMENT
  • #11 19248233
    Anonymous
    Level 1  
  • #12 19248321
    pawlik118
    Level 33  
    clock generates the caliper? or the procec which is the master?
    Of course you can use a converter, but does it make financial sense since an LM358 for 50gr will also ensure correct operation.
  • #13 19248327
    iksrowaj
    Level 3  
    I would like to have a non-inverted signal, hence the PNP question.

    Added after 4 [minutes]: .

    The clock signal is generated by the caliper.
    How to connect this LM385? Any link?
    Greetings
  • #14 19248508
    pawlik118
    Level 33  
    To the (-) input of the LM358 connect: 3.3k to +3.3V, and 1k to GND. To the input (+) the signal from the caliper. Output the amplifier to the microcontroller. If the voltage on the (+) is greater than on the (-) i.e. set with resistors around 0.75V then the amplifier output will be 3.3V. This will ensure that we do not have signal inversion.
    You can use basically any operational amplifier.

    With transistors it will not be so easy anymore, as you would have to take into account the need to draw current from the caliper to supply the base of the transistor.
  • #15 19248737
    iksrowaj
    Level 3  
    It would look something like this?
    Which transistor/scaler? - reading data from an electronic caliper .
    I found something like this on the web
    Which transistor/scaler? - reading data from an electronic caliper
    looks like it works
  • #16 19248754
    pawlik118
    Level 33  
    Seems ok, the circuit with the transistor will unfortunately discharge this small battery from the caliper.
  • #17 19249070
    iksrowaj
    Level 3  
    Battery is not the problem, the caliper is powered from the ESP.
    LM358 connected, 1.9V output signal and ESP does not see it. Maybe some values to change?
  • #18 19249200
    pawlik118
    Level 33  
    LM358 supplied with 3.3V and the output is 1.9V?
  • #19 19249228
    krzysiek_krm
    Level 40  
    pawlik118 wrote:
    LM358 powered from 3.3V and output is 1.9V?
    .
    And how much should it have, after all it is not rail2rail.
    I have already written previously
    krzysiek_krm wrote:
    Using an operational amplifier as a comparator is a poor idea - the amplifier has some things that are not needed for anything in a comparator, such as compensation.

    Modern comparators are from sudden death, they are just RRIO, either push - pull or open drain, sometimes they even have some kind of reference voltage source.
  • #20 19249249
    pawlik118
    Level 33  
    Well yes, in the doc. the LM358 has Vo=Vzas-1.5V. In this situation, the output of the amplifier needs to be pulled up to +3.3V by e.g. 1k.
    Of course there are a whole bunch of comparators, but the LM358 has the advantage that almost everyone has it at hand.
  • #21 19249396
    iksrowaj
    Level 3  
    After pulling up the outputs it works as it should. Thank you.
    I have an LM393 on hand, can it also be used? In the same way as the LM358? only without pulling up the outputs?
    Greetings
  • #22 19249409
    Anonymous
    Level 1  
  • #23 19249421
    pawlik118
    Level 33  
    iksrowaj wrote:
    After pulling up the outputs it works as it should. Thank you.
    I have an LM393 on hand, can it be used too? In the same way as the LM358? only without pulling up the outputs?
    Greetings
    .
    You are very welcome.
    The LM393 has an OC output and pull-up is necessary in this case.
  • #24 19249738
    iksrowaj
    Level 3  
    Which transistor/scaler? - reading data from an electronic caliper .
    The one on the right doesn't work for me, the one on the left does, but if you look at it, it's actually probably not a good solution (I understand that 3.3V goes to the caliper pin, admittedly nothing happens but it doesn't look good).
    I'm still waiting for the Polol 2595 and we'll see how it works, at most a solution with an amplifier or comparator will remain.
    The best would be a solution with a mosfet similar to the BSS138 (bidirectional) but I don't know how to look for one that would work from 1.5V and preferably 1.2.
    Thank you all and best regards
  • #25 19249977
    krzbor
    Level 27  
    I don't know why you see such a problem with signal reversal. After all, as you write the program, this is not a problem. The circuit on the right should work, but in the processor you need to switch on the input pull-up (INPUT_PULLUP) or possibly give 10k resistors to PB-0 and PB-1 and connect to 3.3V. This is the most classic circuit for such applications.
  • #27 19250866
    iksrowaj
    Level 3  
    Thank you for the links.
    The diagram with the transistor is working though. Previously something wasn't contacting me despite pulling the pin up.
  • ADVERTISEMENT
  • #29 19253963
    krzbor
    Level 27  
    iksrowaj wrote:
    This is another question I have, I have found the following transistors reasonably available.
    TN0205AD
    https://tvsat.com.pl/PDF/T/tn205a_vish.pdf
    HN1K02FU
    https://tvsat.com.pl/PDF/H/hn1k02fu_tos.pdf
    PMGD280UN
    https://tvsat.com.pl/PDF/P/pmgd280un_ph.pdf
    Would these be suitable?
    Do I think correctly that VGS(th) is the parameter I am looking for?
    .
    After all, you have a bipolar transistor in the schematic, not a MOSFET. Use any low power npn bipolar transistor.
    As far as the VGS is concerned you have got it right. It just needs to be small. In MOSFETs you have to look for such, in bipolar (silicon) you always have about 0.6V drop across the base-emitter.
  • #30 19254171
    iksrowaj
    Level 3  
    I care about two-way communication and it is not about this particular case.

Topic summary

The discussion revolves around interfacing an ESP32 microcontroller with an electronic caliper powered by a 1.5V battery. The user seeks to convert the 1.5V output signals from the caliper to a 3.3V level suitable for the ESP32 without inverting the signal. Various solutions are proposed, including using a logic level converter, operational amplifiers (op-amps) like the LM358 and LM393, and bipolar transistors such as the 2N3904 and 2N2222. The importance of selecting appropriate components, such as transistors with low Vgs(th) for MOSFETs, is emphasized. The conversation also touches on the need for pull-up resistors and the potential use of a Pololu 2595 converter. The user ultimately finds success with a transistor circuit after addressing issues with signal levels and connections.
Summary generated by the language model.
ADVERTISEMENT