# Creating a simple address and data bus with Arduino Uno as a master using 3-state buffers and decoders

First of all, sorry if my post is too general. If you know a better place for this post please let me know.

# Problem

I have 5 motors to be controlled independently (but not simultaneously, i.e. one motor at once). The motors are supposed to be controlled through 5 motor drivers Leadshine DM556. Each motor driver has 3 control (PUL, DIR and ENA) signals optically decoupled with the internal scheme as shown in the picture (from the datasheet):

I'm considering the Arduino Uno board to control the drivers in turn. Of course, the first thing that comes to mind is to use digital pins of Arduino Uno to drive these lines. But there are several issues regarding this approach. The first one is the current. The DM datasheet says:

So even in case of typical current it would draw $$I_{out} = 3\times 5\times 10 \text{mA} = 150 \text{mA}$$

And as I know from this post:

The total current from all the IO pins together is 200 mA max

Too close I think. The second problem is the number of the used pins. There would be 15 of them! The Uno has only 13, C'mon. OK. From the DM datasheet we see that the ENA signal may be left unconnected (enabled). We can reduce the current and the number of pins to 10. But here comes the third problem : the software. I think it would be a nightmare to write a safe and maintainable code for the above-mentioned configuration.

# My "solution"

I've chosen to use the following configuration (only 4 of 5 drivers are shown):

The PUL+ and DIR- signals are driven by the Arduino pins (D3 and D4) and form the CONTROL BUS. The drivers (DM's) in turn are connected to this bus through the 3-state buffers hosted on the 74AC11244 IC. This IC actually contains 8 of them. So one IC can be used to connect 2 drivers (not 4 because it uses one enabling signal (nOE) for a group of 4 buffers, see the schematics).

The other part is the ADDRESS BUS. It consists of 5 lines (one for each driver) which are connected to the enable pin nOE of the corresponding buffer group. Addressing is performed by the CD74HC138 3-to-8 decoder (NOTE: there must be only one active driver and therefore only one active address line at a time). The Arduino pins D10, D11 and D12 are used to choose the address (A0, A1, A2), and pin D9 is used to enable addressing (ADDREN).

So the algorithm would be as follows :

1. Prepare direction (the DIR+ pin)
2. Choose the motor
4. Perform movement (the PUL+ pin)
5. Disable addressing (all ADDRESS lines are HIGH so all buffers are opened)

# Questions

I am a very beginner in solving such kind of problems. And don't even know if my solution is an adequate one at all. So, one more sorry if it is a silly approach. But here is how I see what's going on.

Does it solve the current problem? I think yes, because the Arduino pins are not connected directly to the DM signal lines. The problems which should be addressed in my opinion are

• The source current of the +5V Arduino pin as it powers all the ICs, and also the sink current of the GNDs. As I know from the datasheets and (again) this post this pin can source 400mA, and GND's are also can source 400mA. Honestly, I am not sure where should I look in the datasheets to answer this question. For example, I see that the DC Vcc or Ground Current for the decoder is +/-50mA. But it's a maximum rating. And what does it depend on? I think it depends on the output of the IC. And the output in turn is connected to the nOE pin of the 3-state buffer whose input current (the Ii characteristic I suppose) is almost zero.

• Other question is about the output of the 3-state buffer. The crucial characteristic I think is the High Level Output Current which for the 74AC11244 buffer is -24 mA but I can't say whether it is the current per pin or the total current maximum.

This solution also reduces the number of pins used: 6 now.

And obviously it is more easier to write control programs now.

# UPDATE

According to @brhans comments I've made another variant without using 3-state buffers. Here the schematics (motors are also shown):

I don't have drivers, motors and 3-to-8 decoder yet, but I've tested the transistor part using 10 LEDs instead of PUL and DIR inputs.

# UPDATE 2

I think don't really need to care about the INTs because in my case GPIO ports are configured to be the outputs. Address lines are connected to the LOW level (all bits are zeros). And I think the RESET pin should also be connected to the Arduino (but for now it has been left unconnected).

# Documentation

74AC11244 (3-state buffers)

CD74HC138 (3-to-8 decoder)

2N3904 (general purpose NPN transistor)

MCP23017 (16-bit I/O Expander

Any help will be extremely appreciated. Thank you in advance.

• You write that you'll only be driving one motor at a time - so by that logic you would only ever need to drive 3 I/Os at a time, for a typical current draw of only 30mA. Jan 26 at 19:12
• You also seem to be ignoring the functionality of the ENA signal to your driver. If ENA to a driver is driven to its disabled state, then it doesn't matter what the PUL and DIR signals are doing - that disabled driver will ignore them. So you could connect all of the drivers' PUL and DIR signals together into a single pair, and then use an individual ENA signal to each driver - for a total I/O count of only 7 pins for all 5 drivers. Jan 26 at 19:15
• However, if you do connect multiple PUL and/or DIR pins together they'll need a higher combined current drive - so you might want to consider using a N-FET or NPN transistor to drive them. Jan 26 at 19:17
• @brhans, Thank you for commenting. (to the 1st comment), I don't know if I understand you correctly but I need to drive one motor at a time, but I also I need to switch between them. (to the 2nd comment) in the DM datasheet it is said that if ENA is not connected than the driver is considered enabled. I don't really understand how your suggestion about connection PUL and DIR together solves the problem. The ENA signal doesn't control the current in the other signals : they are just different optocouples (as one sees in the doc). Jan 27 at 4:09
• @brhans, thank you, got it. BTW, now the 3-to-8 decoder should be ...238 not ...138 (not inverted one) Feb 2 at 15:29

The second point for -24 mA current for 74AC11244 is per pin, and max per pin is actually 50 mA and 200 mA for all pins combined.
I would keep the pulse signals to the microcontroller (using tranistors as buffers as you did though) and connect the rest of the signals to GPIO chip controlled via I2C/SPI bus, such as MCP23017. If you are again out of pins, then I'd route the pulse signals to a shift register, if precise timing is required.