Go Down

Topic: Strange Question (Read 770 times) previous topic - next topic

Ioannis Demetriades

Hey guys I have a weird question.Basically I want to make a project that requires more pins than an arduino uno can offer. I have 2 arduino uno though and because it s a bit hard for me to use I2C communication between them I was thinking to use the analog pins to transfer information. I am new in arduino area so i was thinking if I use anlogWrite from one arduino and analogRead from the other and by connecting the first analog Pin of the 2 arduino, will it be harmful to the to devices?

Grumpy_Mike

Strange only in the way you want to solve your problem. Forget about using two Arduinos it is a common beginners mistake.

Instead look at adding more pins.
1) you can use the Analogue input pins as digital input or outputs.
2) use a shift register to get more inputs or outputs than you will ever need.
3) use a port expander chip connected to either the I2C pins or the SPI pins.

MorganS

analogWrite() sends a series of pulses. For a human looking at an LED this appears to dim the LED. But it is actually on at full brightness for part of the time.

If you read this with an analogRead() you will randomly get either off or on and very little in between.

You could use pulseIn() to read the width of the pulses but that is very rarely done. There is usually a better way to solve the problem.
"The problem is in the code you didn't post."

dougp

Hey guys I have a weird question.Basically I want to make a project that requires more pins than an arduino uno can offer.
Do you need more inputs, or outputs, or both?  Digital?  Analog?  There are techniques to attack each of these.
I don't trust atoms.  They make up everything.

No private consultations undertaken!

pert

You can use a smoothing circuit to get a true analog output from analogWrite() but I'm not necessarily recommending this solution. analogRead() is slow so it's not an efficient way to communicate.

Another solution to consider is to buy an Arduino Mega.

Ioannis Demetriades

Look guys sorry for the confusion. I want to make a circuit that uses a LCD Display(16*2), a 4*4 matrix Pad, a servo and an ultrasonic sensor. The LCD will display the measurements of the ultrasonic sensor and the 4*4 Pad will be used to enter the password for the servo to rotate and also to choose between options shown on the LCD.
I have 2 arduino uno and a nano. Can i proceed to the project with a single arduino device or it will require 2?

adwsystems

#6
Mar 26, 2018, 02:26 pm Last Edit: Mar 26, 2018, 02:37 pm by adwsystems
How pins are you using for each device (and of what type)? That will tell you what type of pins you need more of.

One option would be to connect the display via I2C. That would require only two pins instead of six, but that doesn't help without the answer to question one to see how many more you need.

You can connect two Arduinos together but that will require pins. If you connect via I2C (example available in the reference section) then why not just connect the LCD via I2C and skip the hardware and software complexity.

Grumpy_Mike

#7
Mar 26, 2018, 02:32 pm Last Edit: Mar 26, 2018, 02:32 pm by Grumpy_Mike
Quote
Can i proceed to the project with a single arduino device
YES!

Any shortage of pins can be got round.

Ioannis Demetriades

Thanks a lot. It works by using the analog Pins for the 4*4 matrix pad

Go Up