Author Topic: BUS transceiver eats LED voltage when OE is alternating  (Read 755 times)

0 Members and 1 Guest are viewing this topic.

Offline jbsTopic starter

  • Contributor
  • Posts: 33
  • Country: lu
BUS transceiver eats LED voltage when OE is alternating
« on: April 23, 2020, 08:51:26 pm »
Hello,

I have a puzzling question.

I've attached my build below. DIR is set to HIGH and OE is set to LOW. (VCC=3.3 V). When I measure the voltage across the LED, it reads approx 2 V.

When I put the OE in a permanent and alternating (HIGH-LOW-HIGH...)-loop, the LED reads 1.850 V.
Quote
Arduino code:
...
void loop() {
 digitalWrite(9, LOW);
 digitalWrite(9, HIGH);
}
...

Can someone please explain to me, where I lose the 0.150 V and how to get them back (prevent the loss)?

Here's a link to the datasheet of the transceiver:
http://www.ti.com/lit/ds/symlink/sn74lvc245a.pdf

Appreciate any helpful input. Stay healthy!
Joël
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #1 on: April 23, 2020, 09:10:26 pm »
Not sure if I understand correctly, but if you turn off outputs periodically, there is less LED current on average, and as a consequence less average voltage on a LED. You effectively created PWM with duty cycle of X% vs 100%.
 
The following users thanked this post: jbs

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21695
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #2 on: April 24, 2020, 04:23:06 am »
What is the question? -- Why isn't it 1.0V (half, as you'd expect from 50% PWM, assuming the digitalWrites are evenly timed)?  It's less because the LED voltage doesn't discharge much between pulses, it's being driven open-drain, in effect.  If you add a delay so it's say 100Hz (5ms per write) it should discharge more and you should measure closer to 1V.  Or if you add a pull-down from output to GND, say 1k.  Or at really low frequencies you'll measure 0 and 2V alternately.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: jbs

Offline jbsTopic starter

  • Contributor
  • Posts: 33
  • Country: lu
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #3 on: April 24, 2020, 05:49:54 pm »
Thank you both. I had to google to learn what PWM meant. 

Here's what I'm trying to do:

I have a Teensy (like Arduino) board with a limited number of digital INPUT/OUTPUT pins.

In my project I need to feed the Teensy more input than there are pins available. In order to do that I'm using a few bus transceivers (of type SN74LVC245A).

With the Teensy I can switch between the different transceivers and make only one active, and the other ones inactive. The Teensy will then receive only inputs from that active transceiver.

It's "Synchronicity or Multitasking" that I'm after, if that's the right description. I want the system to behave as if all the inputs were connected to the Teensy (if it had enough pins). Yesterday I was testing it with the use of a LED connected to a transceiver: Setting the transceiver alternatively ACTIVE/INACTIVE in order to emulate multitasking. The LED stayed on, but I was surprised to find that it lost voltage (and it got a bit dimmer).





 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #4 on: April 24, 2020, 06:05:17 pm »
You may be also interested in shift registers, like 74HC595 (that is for outputs), there are shift registers for inputs. Also port expanders (I/O expanders) like for eg. PCF8575, which can switch direction. With these things you can have many inputs and outputs accessed through SPI or I2C from your MCU. They also have latched outputs, it means that if you set an output and latch it, it will stay on.
 
The following users thanked this post: jbs

Offline jbsTopic starter

  • Contributor
  • Posts: 33
  • Country: lu
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #5 on: April 24, 2020, 09:16:37 pm »
Appreciate your help, Manul. I've been learning about those components (and SPI/I2C) for the past 1-2h. Very interesting  :-+
 

Offline jbsTopic starter

  • Contributor
  • Posts: 33
  • Country: lu
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #6 on: April 26, 2020, 09:47:04 pm »
Right, now that I have spent some time reading, I'm still none the wiser about which component to use for my project.

It seems to me that either would work (Shift register, Multiplexer (I2C or SPI), Port Expander, Bus Transceiver,...Arrays?)

Let me give you some more info about my project :
Imagine a button, that when pressed twice, sends two signals to the MCU to measure the time between the two presses.
Now imagine a 100 buttons that can be pressed simultaneously and imagine further that the time measured can vary from 1 millisec up to a couple of seconds (obviously the buttons are not physical, I use CNY70 with a LM339 comparator instead).

I need to measure the time for each button as accurately as possible, without the others interfering and causing delays.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21695
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #7 on: April 26, 2020, 10:25:53 pm »
Careful: "as accurately as possible" implies picoseconds -- that is, what is possible these days.  But you only need milliseconds?  That's not accurate at all, as electronic circuits go.  In fact it's quite easy (which helps!).

Also, is that from press to press, or release to press?  That is, what happens if a "button" is held down for a long time, should the hold duration be included or not?  Does it not matter because the "press" timing is consistent (from whatever your optos are driven by)?

In any case, it's a simple logic analyzer style exercise.  That many inputs can easily be polled on a millisecond schedule, and then you merely need some code to count samples between changes for each channel.  A regular Arduino wouldn't do that very easily or at all, but a Due might, or any other choice with similar power.  A PC might not, because you're limited by USB polling rate and OS multitasking; 10s of ms is likely reliable in that case.

Actually on further contemplation, an AVR might be able to pull off a few hundred bits at 1ms rate; it'll be tight, most likely written in ASM.  Needless to say, you won't achieve that performance in an Arduino sketch, but a more powerful Arduino can.

And then, I don't know what format you want out of it.  Presumably some sort of event saying that a "button" was "pressed" with so-and-so delay, and then the event triggers other functions: logging, alerts, state machine, whatever.  That could be transmitted via serial, say.  You'll need quite a high baud rate to capture every event possible (i.e., if every input is toggling at ~1ms), or something to prevent high event rates (perhaps a holdoff, so that a button will not register an event until some delay has passed since last trigger).  It should probably be buffered, which is fine, buffered serial IO is typical.


In any case, this is probably a good candidate for an embedded solution, or maybe some existing hardware of various sorts.
- Logic analyzers: cheap and plentiful, though not usually offering quite as many inputs (say 16, maybe 32 per module), and far finer timing precision than you need (fractional microseconds), and probably proprietary interfaces (but maybe some offer plugins or interprocess messaging that can implement that?).
- USB GPIO expanders as mentioned: may not have great timing?  A multitasking OS isn't a great place to handle timing finer than a few ms here or there.  (There are some ways around that, of varying difficulty.)  Documented and ready-to-go interface, shouldn't be too painful to program with.
- Maybe a serial port, that supports synchronous operation, married to a bunch of shift registers.  Could potentially be as simple as opening a serial port, prodding it to generate clocks, and reading in binary bytes for processing.  Still subject to OS timing.
- Other modest-bandwidth devices come to mind, like audio or video capture, which again needs a serializer.  Upside, these are buffered so the hardware, OS and software all have the means to deal with latency.
- Terrible hacks -- put the optos in place of keyboard switches?  Keyboards probably don't scan frequently enough, and can't have too many buttons pressed at once (or, most can't anyway).  Would be kind of hilarious to see working.

Thought I had thought of other things too, but nothing more is coming to mind... anyway, lots of possibilities, but you're going to have to program something somewhere to use it, and writing a user program plus embedded program is one of the better compromises.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: jbs

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #8 on: April 26, 2020, 10:37:40 pm »
In that case you may be interested in button matrix (or keyboard matrix) configuration. With that you will need just 10 outputs and 10 inputs (columns and rows) for 100 buttons. But because you use comparators it needs to be somehow adapted. There should be comparators which have OE (output enable) pin. That can be used for row (or column) select in the matrix to simplify and lower part count.

Hard to say which is more easy and efficient, matrix or 100 inputs (7 x 16bit port expanders for eg.). Your project seems huge already (100 comparators with sensors).
 
The following users thanked this post: jbs

Offline jbsTopic starter

  • Contributor
  • Posts: 33
  • Country: lu
Re: BUS transceiver eats LED voltage when OE is alternating
« Reply #9 on: April 27, 2020, 06:07:55 pm »
...
Also, is that from press to press, or release to press?  That is, what happens if a "button" is held down for a long time, should the hold duration be included or not?  Does it not matter because the "press" timing is consistent (from whatever your optos are driven by)?
Thank you, Tim! Much obliged.

My project is building a midi controller for a Piano. The optical sensors are placed for each key and should measure the velocity of the hammer. Each sensor is combined with a comparator and will give me 2 signals corresponding to two points in space (about 1mm apart and close to the sensor), with which I can calculate the velocity. That velocity is used to determine if a note should be played loud or quietly.

I want to read all keys in such a manner that no velocity calculations are compromised (delays) because of slow processing.

I think I will give the shift registers a go and put them in an array (74HC595 and 74HC165 together with Diodes) to be able to use interrupts. Unsure if I need interrupts tbh. In any case, I've ordered the lot (multiplexers, shift registers, io expanders, etc...) for testing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf