So, for now, I require a total of 14 pins, 10 input pins, and 4 output pins.
My question is what could be the best possible board I can use considering the number of pins I require? I can go for UNO but the problem is I have to keep the power consumption as small as possible because the system would be running on a battery and I want the battery to run for a longer time. It doesn't matter how much current is being drawn when the project is in use, but after the operation, the system should go to a deep sleep mode and if possible should draw a current in microAmps. After some research, I came to know that the UNO might be drawing in milliAmps in deep sleep.
Any suggestion would be highly appreciated. Thank you very much.
UNO is an inconvenient and impractical form factor, Nano is better.
But you are powering the USB interface which is only necessary when connected to a PC. Remove that interface and you have the Pro Mini. Remove the regulator from the board and the pilot light resistor, and put it to sleep when not in use.
Paul__B:
UNO is an inconvenient and impractical form factor, Nano is better.
But you are powering the USB interface which is only necessary when connected to a PC. Remove that interface and you have the Pro Mini. Remove the regulator from the board and the pilot light resistor, and put it to sleep when not in use.
Ok great, it means the better option for me would be to go for Pro Mini and that too after removing the pilot resistor and the regulator from the board. Have you any rough idea of how much current would be the board drawing in deep sleep?
Another option would be to use a bare atmega328 28-pin dip chip. You'll gain a couple more pins, because crystal not needed. You won't have to modify any surface mount components and risk ruining the board.
To get lowest power consumption, you can run at 1MHz, perhaps less, switch off various options like BOD etc. For these things, you need an in-circuit programmer. A cheap one like USBASP will be fine. You can use this to upload your sketch also, which means no bootloader taking up flash memory, and you can use pins 0, 1 as you like.
Paul__B:
UNO is an inconvenient and impractical form factor, Nano is better.
But you are powering the USB interface which is only necessary when connected to a PC. Remove that interface and you have the Pro Mini. Remove the regulator from the board and the pilot light resistor, and put it to sleep when not in use.
I have an addendum. Now I have to put an SD card module along with an RTC. So, I require even more i/o pins now. Is it still possible with Pro Mini? Can I also use the analog pins as digital? I saw on the forum that I can but is it applicable to my requirements?
Hi, I am sorry I didn't understand. Can you please explain it a bit?
I just need to hook up a simple SD card module and a real-time clock to the Arduino.
dougp:
If both of them use I2C communication then, since I2C is a bus, they don't each need dedicated pins, they share the I2C pins.
Ah ok, I saw in a tutorial that sd card module uses SPI. And I think RTC uses i2c communication protocol. So, if it is possible then let me search if I can buy both the modules as SPI or i2c to save the pins.
bilal40:
Good. Then that's the thing which I am searching for.
If you build your own 'bare bones' Arduino you can use a regulator such as the MCP1700. You then have the advantage of a stable and know supply voltage for the processor and its sensors etc and the deep sleep current only rises to around 2uA.
Why I frequently on these fora, criticise the advice to "build your own 'bare bones' Arduino" is that if you buy a Pro Mini, it is already done for you, a neat and tested design, no need to get all the necessary parts together, and generally significantly cheaper.
One option would be to get a Pro Mini, remove the regulator and LED resistor (for the "L" and power LEDs) and replace the regulator with the enhanced MCP1700. (By all means correct me, but I presume it uses the standard pinout. )
Ok great, so, I can use analog pins maybe for two LEDs and one relay. Digital pins I would dedicate to the keypad, sd card, and RTC. My hall sensor is analog but I think the ultrasonic sensor needs digital pins. Can I give the analog pins to the ultrasonic sensor, too?
bilal40:
Ok great, so, I can use analog pins maybe for two LEDs and one relay. Digital pins I would dedicate to the keypad, sd card, and RTC.
let's get this straight, I'm not sure that dougp's comments did not slightly confuse you.
On a UNO/ Nano/ Pro Mini, there are twenty digital pins, all of which have exactly the same capabilities such as ability to provide current when set as an OUTPUT, and exactly the same behaviour when programmed to digitalRead or DigitalWrite.
Six of these pins, numbered 14 to 19 in the IDE have aliases as "A0" to "A5" as they are inputs to the multiplexer of the ADC. This is an additional function; you can set them to INPUT or OUTPUT or in fact INPUT_PULLUP as well as using analogRead on them. The consequence of this is that if you set one to OUTPUT and write it HIGH, it is going to read a value very near 1023, depending on how much current is being drawn from it. In fact, you can even use this to estimate the current being drawn!
Similarly, setting an analog pin as INPUT_PULLUP allows you to use the approximately 47k internal pull-up as a bias source to the device - such as a thermistor or LDR - that you are measuring.
Point being, it makes no difference in terms of pin circuitry and programming whether to allocate your analog pins for one digital function, input or output and your "plain" "digital" pins for another, or exchange the two sets of pins. Every digital pin including the six "analog" pins, is just the same.
(Noting that the Nano and Pro Mini have the seventh and eighth pins as purely analog inputs to the multiplexer, with no digital functionality.)