Additional GPIOS GPIO IC Vs AVR

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

 

I need additional GPIO's to control various Relays etc.

 

My primary PCB has both UART and I2C output ports, therefore i can either connect any additional PCB with an AVR or a GPIO IC such as TCA9534A.

 

What is the best way to create additional GPIOS?

 

Use a device like TCA9534A or an AVR?

 

I might be wrong but using multiple TCA9534A would be the simplest way?

 

 

 

 

This topic has a solution.

Thanks

Regards

DJ

Last Edited: Fri. Jul 16, 2021 - 08:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need a clearer specification like budget, board area, EXACT expansion requirements like IO current limits, voltage tolerance etc.

 

If it really is just IO then port expanders will likely be cheapest but if there's any chance you might need access to "extra" peripherals then the micro may give you more "expansion possibilities" but it may cost more. If you are building 3 the cost may not matter. If you are building 3,000,000 every last $0.01 counts hugely!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use shift registers on a daily basis.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
I need additional GPIO's to control various Relays etc.

 

https://www.ebay.com/itm/1609273...

Multi-relay board interfaces using only two i/o pins, spi (two wire interface), multiple boards can be daisy chained if needed!

 

OR I2C solid state relay module:

https://www.amazon.com/Channel-R...

https://www.amazon.com/IOT-Elect...

or magnetic relay module:

https://www.amazon.com/Channel-E...

Jim

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

 

Last Edited: Tue. Jul 13, 2021 - 06:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
What is the best way to create additional GPIOS?

As always, it depends on your definition of "best".

 

You need to specify the criteria for your particular project - without knowing the criteria, "best" is meaningless.

 

Have you tried drawing up a list of the pros & cons of each approach?

 

For using an AVR, remember to factor-in the cost of developing & maintaining the code, and programming the devices.

 

using multiple TCA9534A would be the simplest way?

"simplest" is also rather subjective ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Jul 13, 2021 - 04:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try a 74HC595  ...very cheap, or a HEF4894 for more outputs (12)

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kabasan wrote:
 shift registers .

avrcandies wrote:
 74HC595  ... or a HEF4894

 

But OP only mentioned UART and I2C as available - unclear if they could be "repurposed" ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am looking to get about 50-60 PCBS made. I aim to control some Relays and Triac's. If current is limited, i can always use a transistor circuit. The voltage can be either 3.3V or 5V.

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
74HC595 

 

74HC595 Looks like a good choice. I guess i could make my UART pins, simple GPIOS to set the output instead. 

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

74HC595.

AVR is not a recent product. On The Beginning, It Was 8 Bits. It was easy, then, to do out PORT, reg for access to HC373/374, 20-pin/8-bit luxury that normal AVR user can not afford.

 

Fortunately, HC595 can be adapted to SPI. This chip, HC595 is perhaps the most used one by AVR fans (and I challenge other opinions).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

grohote wrote:
AVR is not a recent product.
though with recent updates.

AVR Dx 64 pin are available though most are long lead (iow a few have a reasonable lead-time)

 

PORTMUX | I/O Ports and Pinouts | Migration from the megaAVR® to AVR® Dx Microcontroller Families

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

gchapman wrote:
AVR Dx 64 pin are available though most are long lead

One could cut them down a bit to fit the pads.

 

Sorry everyone - I'll get my coat.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

74HC595 looks promising, but can it be operated from 2 GPIO pins? If not, I guess i need to look for something in the following range:

I2C General-Purpose I/Os | Products | I2C | TI.com

 

 

 

 

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, you do not like to drive it by SPI, which btw. does engage 4 wires. You can then search the net for Two Wires LCD and One Wire LCD.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its just that my Primary PCB which will be controlling that has for i2C and UART port which is accessible. 

 

 

TCA9535,looks very promising with 16 GPIO pins. 

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

74HC595 looks promising, but can it be operated from 2 GPIO pins? If not, I guess i need to look for something in the following range:

You easily can use 2 pins, clock and data,  The latch sig can be made using an RC from one of the 2 signals...In fact, with enough cleverness you can get it to 1 wire, with some tradeoffs. 

 

Of course, if you have I2C , why mess around?

 

Even better...send your uart to another AVR...the you can tell that avr to turn on various ports, have timers  (turn on PA3 for xx ms  & PB5 for xxx ms, PWM, etc, you can even use the adc  (turn on PB2, when ADC <= xxxx counts)  ...anything you can imagine

 

Turn on PA3 whenever PA2 is low while PA6 is high

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Jul 15, 2021 - 11:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Even better...send your uart to another AVR...the you can tell that avr to turn on various ports, have timers  (turn on PA3 for xx ms  & PB5 for xxx ms, PWM, etc, you can even use the adc  (turn on PB2, when ADC <= xxxx counts)  ...anything you can imagine

 

This. My experience has been that it is often better to have lots of smaller parts doing less, in terms of both programming simplicity and power usage, than one humongous part with everything but the kitchen sink included.

 

"do this and tell me when you're done" is a very handy way to program in an event driven style.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Even better...send your uart to another AVR...

Which takes us right back to the original question!

in #1, djoshi wrote:
What is the best way to create additional GPIOS?

 

Use a device like TCA9534A or an AVR?

 

laugh laugh laugh 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

74HC595 looks promising, but can it be operated from 2 GPIO pins? If not, I guess i need to look for something in the following range:

You easily can use 2 pins, clock and data,  The latch sig can be made using an RC from one of the 2 signals...In fact, with enough cleverness you can get it to 1 wire, with some tradeoffs. 

 

Of course, if you have I2C , why mess around?

 

Even better...send your uart to another AVR...the you can tell that avr to turn on various ports, have timers  (turn on PA3 for xx ms  & PB5 for xxx ms, PWM, etc, you can even use the adc  (turn on PB2, when ADC <= xxxx counts)  ...anything you can imagine

 

Turn on PA3 whenever PA2 is low while PA6 is high

 

 

Seems to be a good idea to have a bit more flexibility using AVR, we use ATMEGA48A on few other boards, so i aim to use the same AVR . Unless there would be better to anther AVR, my aim is to keep the cost down and have much uniformity on all my BOMs. I will be controlling some Relays and possibly some Triacs, so i guess i just need a static ON/OFF. Where would we need to use timer?

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
Unless there would be better to anther AVR, my aim is to keep the cost down
All these modern, new, XMega derived AVRs (AVR-0, AVR-1, AVR-Dx, etc) seem to deliver far more "bang-per-buck than old school models like mega48. If cost is the imperative I'd do some research.

 

To give you an idea (though these are not identically specified devices) a mega48P is listed by M'chip as $1.75-1.90 for 100-199 while a tiny427 (24 rather than 28 pins) is $0.67-0.75 - so less than 1/2 price. You would have to weigh up a comparison of all the peripherals though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
my aim is to keep the cost down and have much uniformity on all my BOMs.
Wish you luck though is a good goal.

Choose parts with a lead-time history (IIRC, there are such services as that data is at the distributors)

Continual calculation of risk, risk evaluation, risk plan, risk mitigation; be innovative though can be difficult (qualification, verification, validation)

 

P.S.

If possible, choose AVR that are wafer fab'd at Microchip.

How to search for Microchip PCNs

 


PSP Letter (Preferred Supply Program)

Lead Time | World's Largest Inventory of Microchip Products

 

edit :

one of several (many?) AVR wafer fab PCN :

Tempe Fab 2, Gresham Fab 4 | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Jul 16, 2021 - 03:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's True

 

I found SAMD21 has lower price then a existing XMEGA we are using. 

 

I will need to do a comparison. 

Thanks

Regards

DJ

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where would we need to use timer?

Wherever you need a timer, that's where...turn a pin on, off, or maybe on for xx ms 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks I will get down to some planning and designing. 

Thanks

Regards

DJ