Is this pins working like this ?.

Hello All,

I am a new to this Arduino. I have already experience in PIC 8 and 16 Bit and ARM controllers. But I am New to this Arduino. I love it also. Because this is C++.

I am using Original Pro mini.
Arduino v1.6.13.

I am developing Home Automation Projects.

I continuously confusing to choosing the pin functions.

Third Alternation(5-2-2016)

I found Default pins on UNO and Promini.
0,1 Hardware Serial.
Pwm pins 3, 5, 6, 9, 10, and 11.
Interrupts pins only 2,3 on uno and pro mini.

I am using these pins for these functions.

Hardware Serial - 0,1.---------------Bluetooth.
Interrupt pin - 2.-----------------Zero crossing detection for Dimming the 230volt AC bulb.
Software Serial - 3,4.---------------WiFi. Software Serial
Input - A0,A1,A2,A3,A4.----Buttons.
Output - A5,5,6,7,8.--------Relay and Triac BTA12.
Analog Inputs - A6,A7.-------------Pot input for vary the speed.
nRF24L01 - 9,10,11,12,13.-----nRF24L01 Radio Chip SPI.

Can I use these pins like this at a time. or any Restriction when I use this pins ?. Because I am using same ports as input and output also and even some pins also interrupt and spi.

Can I use Software Serial 3,4 ?

If I using these pins for these functions then I face any problem or may problem occur ?.

The main problems with using pins is if they have have specific purposes that you also want to use. The classic example would be using pins 0 and 1 for input or output and also trying to use the hardware Serial interface which is hard wired to use them.

Another gotcha is the use of the SPI pins, 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK) the I2C pins, A4 (SDA) and A5 (SCL), for other purposes when also using SPI.

SureshKumar2610:
If I using these pins for these functions then I face any problem or may problem occur ?.

I think what you are proposing will work.

However it is useful to keep Pins 0 and 1 free for Serial communication with the PC so you display debug messages in the Serial Monitor. Without that ability it can be difficult to diagnose and solve problems.

You should also be aware that SoftwareSerial is very much inferior to HardwareSerial so I would use SoftwareSerial for the least used between your Bluetooth and Wifi connections.

In view of all the connections you need it would be worth considering a Mega which has 3 spare HardwareSerial ports and lots of extra I/O pins.

...R

Ok. Thank you. every one. I am only using the SPI for nRF, HW serial for Bluetooth, some analog pins for inputs, some analog pins for outputs, some digital pins for inputs and outputs except already used pins.

Finally I got it.

Hardware Serial - 0,1.---------------Bluetooth
Interrupt pin - 2.-----------------Zero crossing
Software Serial - 3,4.---------------WiFi
Input - A0,A1,A2,A3,A4.----Buttons
Output - A5,5,6,7,8.--------Relay
Analog Inputs - A6,A7.-------------Pot input
nRF24L01 - 9,10,11,12,13.-----nRF24L01 Radio Chip

2 pins for external inputs
A6,A7 for analog input,
I am not using I2C now,
3,4 for software serial for wifi.

Can I use the esp8266 module in HW (0,1) serial. After programming ?.

SureshKumar2610:
Can I use the esp8266 module in HW (0,1) serial. After programming ?.

Yes you can.

But how will you fix problems if your program does not work?

...R

There's no problem with the functionality of the pins you have assigned. Using the hardware Serial port for a module limits yours debugging ability, but it won't hurt functionality.

The only subtle issue might be this:

Analog Inputs - A6,A7.-------------Pot input for vary the speed.

The A6 and A7 only exist on the SMD packages of the ATmega328P. If you try and port your project to the 28 pin DIP package that is used in the full sized Uno board, you will need to reassign those pins.

I am using pro mini.

The A6 and A7 only exist on the SMD packages of the ATmega328P. If you try and port your project to the 28 pin DIP package that is used in the full sized Uno board, you will need to reassign those pins.

The important part of the above advice is

If you try and port your project to the 28 pin DIP package that is used in the full sized Uno board, you will need to reassign those pins.

You may currently have no plans to port the code to another platform but you need to be aware of the problems that could arise should you do so. It would be better to avoid the use of A6 and A7 if possible or to at least include comments warning of the potential problem.

SureshKumar2610:
I am using pro mini.

I am aware of that. The Pro Mini uses the ATmega328P chip which, like most ICs, comes in more than one package. The pro mini (and the Nano) uses the TQFP-32 package. The Uno uses DIP-28, which has 4 less pins. The 32 pin SMD packages use those extra 4 pins to provide an extra pair of power pins and 2 more analog inputs (called A6 and A7 in the Arduino environment).

If you stick with a board that uses an SMD version of the chip, there's no problem. Just be aware that if you move to the DIP version of the chip, those two analog inputs won't be there even though it's technically supposed to be the same chip.

"even though it's technically supposed to be the same chip."

It's the same die inside 2 different mechanical packages, with one package not making all the pins available as you noted. So no "technically" about it, it is the "same chip".

You are picking nits, sir.