Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pin

Moderators: odroid, mdrjr

Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pin

Unread postby zx890c » Sat Apr 14, 2018 3:13 am

Hello everyone,

I've been working on a circuit to control the HC-SR04 Ultrasound sensors using only one GPIO pin on the XU4 from the Shifter Shield. The motivation for this is being able to ping 8 sensors without taking up 16 pins on the shield since each sensor has an trigger input, and an echo output.

So far the solution I've come up with is using SN74AS757 Buffer ICs to switch between triggering and listening for echoes. They are functionally equivalent to the '244s, but these have complementary enables and open collector outputs that can step up to the 5V necessary for triggering, and inputting to the shifter board.
I'm essentially using two chips to control all eight sensors, and have gotten decent results with 4-6; however, once I try to hook up the rest, I run into issues with certain sensors dropping out, or oscillations with the buffers getting warm.
I've ruled out the sensors being the issue, testing each one separately to be sure; and ruled out my wiring and connections.

I'm wondering if it could be some pull-up/pull-down issue with the shifter shield's TSX0108E chips that I'm not understanding/adhering to. I noticed that probing the pin side on the shield can be quite finicky as it tries to see who's inputting/outputting from the circuit.
The trouble I seem to be having is that if the TSX0108E chips are open-drain, then I'd need some sort of pull-up to source current; but I saw on the wiki-page: "https://wiki.odroid.com/accessory/add-on_boards/xu4_shift_shield" that no values smaller than 50k should be used, and I'm unsure if this will be compatible with the open-collector outputs on the '757s which normally use resistors in the 1k-10k ranges.

I've attached a schematic of the buffer as it currently functions.


Any help would be greatly appreciated!
Attachments
GPIO_Buffer_Schem.png
GPIO_Buffer_Schem.png (4.49 KiB) Viewed 423 times
zx890c
 
Posts: 10
Joined: Wed Nov 22, 2017 12:08 pm
languages_spoken: english
ODROIDs: Odroid-XU4

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby odroid » Sat Apr 14, 2018 9:30 am

Can you capture the signal on GPX.N with an oscilloscope when you do TX and RX?
What happens if you connect the SR04 sensor to the Shifter-Shield directly?

The bi-directional level-shifter TSX0108E seems to be quite sensitive.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby zx890c » Sat Apr 14, 2018 3:08 pm

I've captured the GPIO pins at the GPX.N pin for the GPX1.2 and GPX1.3 pins.

I tested with a target 6cm away, confirmed with a terminal output.
The first oscilloscope capture displays the GPX.N signal's echo return, as measured from the right rising edge to the negative spike. The formula I used is from the HC-SR04 datasheet (Pulsewidth = pulselength (uS) / 58). For the scope capture, the time from the right rising edge to the negative spike is 380 uS; dividing this by 58 yields, approximately, 6.5 cm, which is what I was reading from the terminal output.

The second oscilloscope capture displays the 10uS pulse required to trigger the HC-SR04.

And the third oscilloscope capture displays the procedure applied to pin GPX1.3 (pin #19 on the shifter shield). I can't seem to get it functioning correctly at all.


Connecting the HC-SR04 to the shield directly does seem to work, but switching between driving and listening seems to be difficult.

Thanks so much for your help Odroid!
Attachments
GPX1.3.png
GPX1.3.png (40.76 KiB) Viewed 393 times
GPX1.2_2.png
GPX1.2_2.png (36.42 KiB) Viewed 393 times
GPX1.2_1.png
GPX1.2_1.png (36.37 KiB) Viewed 393 times
zx890c
 
Posts: 10
Joined: Wed Nov 22, 2017 12:08 pm
languages_spoken: english
ODROIDs: Odroid-XU4

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby zx890c » Sat Apr 14, 2018 4:52 pm

Sorry, the order is reversed. The third is the first, and the first is the third, etc..
zx890c
 
Posts: 10
Joined: Wed Nov 22, 2017 12:08 pm
languages_spoken: english
ODROIDs: Odroid-XU4

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby odroid » Sat Apr 14, 2018 6:00 pm

I think the dynamic direction changes might cause the problem.
How about sending a trigger signal to all 8 sensors with a single output GPIO and reading the Echo pulses with individual 8 input GPIOs?

BTW, do you use the WiringPi library to access GPIO and Interrupt?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby zx890c » Sun Apr 15, 2018 3:42 am

I believe you are right. On the datasheet of the TXB0108 they advise on pg. 14: "For the same reason, the TXB0108 should not be used in applications such as I2C or 1-Wire where an open-drain driver is connected on the bidirectional data I/O."

I will probably re-work my board to do just that then: trigger them simultaneously, and listen for the echo on different pins.
However, If I'm not always tracking the inputs on the other echo lines, should those be left as inputs? Does the TXB and the XU4 make them high-impedance when configured as inputs?

And I've been configuring them using the example on the wiki: http://odroid.com/dokuwiki/doku.php?id= ... o_register


Thanks so much again!
zx890c
 
Posts: 10
Joined: Wed Nov 22, 2017 12:08 pm
languages_spoken: english
ODROIDs: Odroid-XU4

Re: Control Inputs+Outputs w/ one XU4 GPIO Shifter Shield pi

Unread postby odroid » Sun Apr 15, 2018 12:41 pm

Consider using the WiringPi library.
https://wiki.odroid.com/odroid-xu4/appl ... o/wiringpi

Also check the GPIO IRQ feature to measure the length of Echo signal accurately.
https://wiki.odroid.com/odroid-xu4/appl ... e/gpio/irq

Since the TXB0108 has internal pulling resistors, continuous input direction should be fine.

When we tested our Weather board with Shifter-Shield via I2C bus, it worked well.
https://wiki.odroid.com/accessory/senso ... ter_shield
But it didn't work when the cable was very long (over 80cm).
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 2 guests