Have I got enough pins in my Uno or should I use another board...?

Hi,

Still a bit of a newbie but learning fast.

My current project is to control the humidity in a glazing system. The task is to monitor 8 sensors and switch on 1 of 8 pumps when the right humidity condition has been met. So far I've got 8 inputs (from the sensors) and 8 outputs (to the pumps); I'll probably add a simple LCD display (one of those 16 x 2 ones) and link it all in to my home network.

At the moment I'm doing all my learning and this project on an Uno; which has got the 20 pins.

My questions are:

Will the Uno have enough input/output pins to do all of what I plan to include or should I use an Arduino with more pins (Mega?).

If I need to use a Mega then would the sketch I'm working on for the Uno be transferable to the Mega without too much ado?

Cheers

Ron

As you say, 8 inputs, 8 outputs, 2 for serial for networking - leaves 2 for display.
Use an I2C interface display.
http://www.newhavendisplay.com/serial-displays-c-253.html

Code will transfer easily to 1284/2560 based boards.

Are the sensors digital? Or do they have an analog level you want to monitor?
Uno only has 6 analog inputs broken out in the 328P DIP - if you use an SMD version in 32 pin TQFP, all 8 analog inputs are available.

Pumps will need some kind of buffering - simplest is controlling an NPN or a Logic Level N-channel MOSFET to connect - of pump motor to Gnd to turn it on.

Hi,

Quick reply, thanks.

My Uno came was part of an entry level kit with and it came with a display, presumably this is a parallel connection? So a serial one is the answer.

I'm using DHT22 digital sensors and I'll do as you say with transistors to switch the pumps.

This is a bit early I suppose but I plan to build this into a box etc and I think it would be a good idea to make the wiring a bit more permanent.

What do others do? Buy a pcb and the components to copy their Arduino circuit or is it best to buy another Arduino?

Where do I start on this part of the project? (you can tell I'm new to all of this!!)

Cheers

Ron

I make PCBs. Others use Uno for development, then use a Promini in the design in place of the Uno.
Just making 1 of these? Maybe just wire one up on perfboard.
Here is Arduino functionality at lower left, with some custom circuitry around it,
and an adapter board to make a circuit easy to duplicate & use, in this case a MAX7219 for LEDs.


Hi Ron,

JonRon:
a display, presumably this is a parallel connection?

Probably, but post a link to the kit or a picture of the display.

JonRon:
I'm using DHT22 digital sensors and I'll do as you say with transistors to switch the pumps.

I'm surprised Bob (CrossRoads) didn't suggest this (he usually does) but a TPIC6x595 (where x is A, B, C or D, depending) might drive your 8 pumps with only 3 pins. But you will need to build a shield or a separate stripboard or something. Are you up for that or looking to avoid soldering?

Hi,

That all looks excellent and I'll definitely go down the road of either solder up a pcb (or veroboard) or use a Pro Mini or similar.

Back in the early '70s I did do some electronics at college. That was a long time ago, components were a lot bigger and making pcbs with copper clad board, indelible felt pen, mini drill and ferric chloride was easy enough. So I'm certainly up for a bit of soldering.

So this TPIC6x595 sounds a good idea....where do I start with finding out more about how to use it?

Many many thanks

Ron

PS Here is a link to a page on Instructables. The LCD I'm using is the same as this one.

Yes, it's a parallel display so will need 6 pins. It could share two with the tpic6x595, so 7 for both devices.

What is the spec of those pumps?

Well, seeing as saving on pins is the game then I could stretch the budget to a serial display.

The pumps are 8w 240v and switched with some finder relays 12v so will still need some transistor setup.

Cheers

Ron

There's also a challenge in working out ways to use what you already have.

Whats a "finder relay"?

Those tpics can almost certainly drive the relays directly. Its what they're designed to do.

PaulRB:
There's also a challenge in working out ways to use what you already have.

Whats a "finder relay"?

Those tpics can almost certainly drive the relays directly. Its what they're designed to do.

just make sure the total load of all relays does not exceed the total package load for the TPIC
12v coils are probably less than 100mA so would be well within the capability.

One other thing to note about pins is if you use i2c for the display, it will use pins A4 and A5. This will reduce the number of analog pins to 4.

However, i2c is a shared bus protocol, and you can hook various slave devices to the bus, including devices that give you more digital inputs or outputs, such as the MCP23017: MCP23017 - i2c 16 input/output port expander : ID 732 : $2.95 : Adafruit Industries, Unique & fun DIY electronics and kits.

If you need more analog inputs, there are i2c devices for that as well, such as the ADS1015: ADS1015 12-Bit ADC - 4 Channel with Programmable Gain Amplifier : ID 1083 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits or the ADS1115, which gives more precision to the analog values, while ADS1015 gives the same precision as the uno: ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier : ID 1085 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits.

On the other hand, it is a lot simpler if you don't have to add extra chips, and you just have more pins. The Mega has lots more pins, and is perhaps the simplest solution. It has 53 pins for digital input/outputs and 16 analog input pins (which might be used for digital input/output, depending on the chip).

You could do it with the Teensy 3.1 (my microprocessor of choice), but having to switch from 5v to 3.3v might be a problem.

The Mega has lots more pins, and is perhaps the simplest solution.

Now that good MEGA copies are close to $20 it makes sense to use it instead of various expander approaches. And you also get 4x the memory!

DISCLAIMER: Mentioning stuff from my own shop…

MEGA example HERE:

and to make connections to all those pins much easier, add a MEGA Sensor Shield:

How-To about Sensor Shields HERE:

Cables and Connections HERE:

MEGA details HERE:

Hi and thanks for all the replies.... a lot to take in....penetrating slowly.

The shift register route seems like quite a good one if I could get it to work. The relays I plan on using are made by Finder and have a 12v coil and draw about 45mA so if a TPIC6B595 can switch this then it'll save me making up transistor buffer. Any rate, I've ordered a 74HC595N from CPC in the UK http://goo.gl/pejJ91 so that I can experiment....probably something I should know about.

However the idea of all those pins on a Mega is very appealing, but are there good and reliable copies made which I can get in the UK? Or should I think about buying from abroad?

Many thanks

Ron

74HC595 can't sink current from 12V source.
Need open drain output of the TPIC6B595 for that.
Or add a ULN2803 type driver with the HC595.

Can't you buy a Mega directly in the UK?

Hi,

I ordered the 74HC595N mainly to experiment but I'll get a TPIC6B595 for the proper project.

Presumably I'd have to use a ULN2803 type driver for those relays if I used a Mega?

Haven't really found a good source in the UK yet for Arduino boards or copies....no doubt there is somewhere. If not then I can always buy from the USA (where the prices seem to a lot cheaper!)

Many thanks

Ron

Yes, ULN2803 if using Arduino outputs directly, or as buffer for 74HC595. TPIC6B595 can handle 12V directly.
Don't forget diode across the relay coil - cathode to +12C, anode to chip output.

US prices cheaper, but shipping is more?
Where in UK are you?

Hi and thanks,

West Wales....miles from anywhere. We're used to getting this sort of thing mail order.

Cheers

Ron

Ron, why do you need so many more pins? Future expansion? Your current requirements require only 15 and Uno has 20. If cost is a factor, a Pro Mini, Pro Micro or Nano 3 would also suit. Smaller too. And all those have the same chip and about 100 times more speed and memory than you will need for what you have described so far.

Cheapest place to buy from in UK is from China on eBay, same as everywhere else. Cheapest UK sources are, again, eBay. Megas from aroubd £12 versus £30+ in most other places.

How'd you get 15? Original post said 8 input, 8 output, networking, plus TBD display.

I was thinking 8 input but only 7 output, 6 for the lcd and 3 for a tpic6x595, but 2 pins shared between the shift register and the lcd. Hadn't considered networking.

But actually, now Ron will have a 74hc595, he could use that to drive the lcd, daisy chain the tpic6x595 to it and need only 3 outputs, so use spi. Seem to remember ethernet adaptors also use spi.