Best logic family to interface with Arduino Nano

Thread Starter

s14rs4

Joined Sep 15, 2016
75
I want to use shift registers (serial to parallel and parallel to serial) to expand the IO of an Arduino Nano to over a hundred. Which is the best logic family to use. The application is to drive IR diodes and IR transistors. I been successful using individual IO up to 15 but now I need to expand it. What would you suggest, CD4000, 74HC ? Speed is not critical.
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
74HC is probably your best bet. CD4xxx logic is less popular and the prices are trending upward.
Thanks Dennis, that was what I was thinking. CD4xxx is a bit old school now. I am a bit rusty on logic families. I searched for the logic thresholds for Arduinos but couldn't find any specs.
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
They should be standard CMOS levels which will make them compatible with 74HC or CD4xxx logic operating at the same voltage.
I used 74HCT14 schmitt trigger buffers on the Phototransistors, because that was all I had lying around and they worked fine. But now I am designing a PCB I wanted to use the right thing.
 

djsfantasi

Joined Apr 11, 2010
9,156
The 74HC195 4 bit parallel-in shift register is a popular chip for expanding Arduino. Sites like SparkFun even carry them, is used so often for that application.
 

dl324

Joined Mar 30, 2015
16,839
I used 74HCT14 schmitt trigger buffers on the Phototransistors, because that was all I had lying around and they worked fine. But now I am designing a PCB I wanted to use the right thing.
74HCT has TTL compatible inputs (but they're still CMOS devices). CMOS outputs can drive TTL inputs (with reduced fan-out), but TTL outputs can't always drive CMOS inputs.
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
The 74HC195 4 bit parallel-in shift register is a popular chip for expanding Arduino. Sites like SparkFun even carry them, is used so often for that application.
I was looking at the 74HC164 and 74HC165 eight bit shift registers, would they not be better? I might be wrong, I have not gone that deep into the design yet.
 

dl324

Joined Mar 30, 2015
16,839
I was looking at the 74HC164 and 74HC165 eight bit shift registers, would they not be better? I might be wrong, I have not gone that deep into the design yet.
What are you trying to drive that makes you think you need to expand capability to 100+ (outputs I assume)?
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
What are you trying to drive that makes you think you need to expand capability to 100+ (outputs I assume)?
What I want to do is enable an IR LED and an IR phototransistor pair in an array. One pair after other in sequence. There will only be one pair on at a time.
 

dl324

Joined Mar 30, 2015
16,839
What I want to do is enable an IR LED and an IR phototransistor pair in an array. One pair after other in sequence. There will only be one pair on at a time.
You can wire them as a matrix. Charlieplexing will require the smallest number of I/O's, but I find normal multiplexing easier to follow.

https://en.wikipedia.org/wiki/Charlieplexing

Using a combination of hardware and software, you can pick whatever is easiest for you to implement. I did a 4x4x4 LED cube using 8 ouputs (I thought it would be easier to drive 4 LEDs at a time instead of one).
Now I'm rethinking that logic for an 8x8x8 because it's easy to vary duty cycle for a single LED that way.
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
You can wire them as a matrix. Charlieplexing will require the smallest number of I/O's, but I find normal multiplexing easier to follow.

https://en.wikipedia.org/wiki/Charlieplexing

Using a combination of hardware and software, you can pick whatever is easiest for you to implement. I did a 4x4x4 LED cube using 8 ouputs (I thought it would be easier to drive 4 LEDs at a time instead of one).
Now I'm rethinking that logic for an 8x8x8 because it's easy to vary duty cycle for a single LED that way.
Maybe my explanation was not clear, the IR pairs are in line. I want to read them in sequence one after the other. It will be a serial readout.
 

dl324

Joined Mar 30, 2015
16,839
Maybe my explanation was not clear, the IR pairs are in line. I want to read them in sequence one after the other. It will be a serial readout.
It's still not clear. If only one pair is on at a time, why do you need hundreds of outputs?
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
It's still not clear. If only one pair is on at a time, why do you need hundreds of outputs?
The serial to parallel shift registers will be switching the IR LEDS on in sequence.
The parallel to serial shift registers will be reading the matching IR phototransistors giving a serial output to the Arduino. I will be measuring the movement of an object passing through them. I will scan the whole line one after another. The object will be moving relatively slowly compared to the scan time.
 

Thread Starter

s14rs4

Joined Sep 15, 2016
75
Have you thought of using I2C port expanders?
http://www.hobbytronics.co.uk/mcp23017-16bit-port-expander
8 of these can be run on the I2C bus, giving 128 I/O pins. It may be worth a look as some of the functions, like interrupt on pin change may be of use.
But just plain shift registers may be better for your application.
Yes I looked at these first, but I think it is a bit of overkill. I will only be using outputs on the transmitters and inputs on the receivers. all I want to do is clock a synchronised bit through the transmitters and the receivers. I think shift registers are the way to go. I can link the serial out of one shift register into the input of the next, I can then link boards to as many as I want.
 

danadak

Joined Mar 10, 2018
4,057
Here is an example, one chip, 64 bits. Uses most of the chip I/O, but very little
of the rest of the chips resources. See right hand window, chip resources used/left.

Example below is Serial in parallel out. Serial in is a sampled input, user then creates, in
code, a serial buffer, and using a pointer extracts 8 bit segments and writes to the
output registers. I estimate maybe 30 lines of code max...Might be possible to eliminate
the output registers and use direct pin APIs to manage pin state.

Another example is a community based component of the 74HC164, you import component
into tool, palce 8 of them onto design canvas, wiring them up with wire tool, and out to pins. Thats a full
HW approach to the problem. Again one chip. In this case no code required.

The parallel to serial can be done either way. You could do one chip all as serial to parallel
or parallel to serial, or 1/2 of both.

The solution for parallel to serial, take the output registers and replace with input registers,
output pins with pins configed as inputs. Or used the community 74HC165 and import
that into tool. That would be like the 74HC164, a HW no code approach.

A component in PSOC is an onboard resource. Attached is a catalog for the 5LP family
of chips. Note catalog does not show the community designed components, found here -

https://www.cypress.com/validated-components


1585349980536.png



Compiler and IDE (PSOC Creator) free - https://www.cypress.com/products/psoc-creator-integrated-design-environment-ide

PSOC 6 has 102 I/O, I think you could probably get somewhere in the range of 90+ I/O out of it. Its a high end dual
core part that would be a waste of silicon for this project, eg. a lot of the other capabilities of the part you would not
be using....

I have not looked at this but should be able to tie input and output regs together, and using a single pin and small amount
of code to flip I/O pin from In to Out to allow chip to function as either a 64 bit P > S or S > P. A kind of universal chip.
That being said again I think you should be able to not use the registers, just use pin APIs to R/W pins.


Regards, Dana.
 

Attachments

Last edited:

danadak

Joined Mar 10, 2018
4,057
I think I found a user created component to do the job. Its verilog based. Uses
a lot less chip resources.

In PSOC Creator users can create custom components with verilog and or gui
schematic method.

I modified Verilog to make it 64 bits, and it compiled and routed. Warning I am a novice in Verilog,
so need to test result. Note the Pin_2 is actually 64 pins. Also the shift_in is connected to a pin. That could
easily be changed to an internal reg bit to be controlled in code if needed.

1585397314096.png

Note using this component, and nothing else in chip, would result in a codeless design.

If you want I can post the project so that you can look at it in the IDE. Let me know.


Regards, Dana.

PS : I tested design seems to work fine. This is a no code design if receiving serial data from
external source. If internal that means you are generating it and that implies code to do so.
 
Last edited:
Top