Go Down

Topic: Using multi-purpose pins (Read 111 times) previous topic - next topic

Fulliautomatix

Hi,

I've got a project that uses all the pins on an arduino UNO. I really need one more digital I/O pin, my only option seems to be digital pins 1 or 0. The problem is that these are used as the Tx/Rx pins when upload code or monitor the output.

The question is, how can I use one (or both) of these pins AND still download code and de-bug my project?

Isaac96

Are you using the analog pins as well?
If you have used all the pins, use the RX/TX pins as outputs to transistors which then drive something else, or anything with a high-impedance input.
What do you have connected?
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

Robin2

Are you aware that the analog pins can be used as normal digital I/O pins.

You can use external port-extender chips to get more I/O pins (sorry can't remember the chip name).

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Isaac96

74HC595-shift register for 8 outputs from 3 inputs
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

INTP

There may be a lot of room for optimization but there's no way to show you if you're not showing your setup.

spycatcher2k

Are you using the analog pins also?
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details.

Fulliautomatix

4 digital pins are used for writing to an SD card, 6 are used for connecting to a 20*2 LCD screen, two pins are used to drive servos, and the remaining 2 are the Tx/Rx lines.

Two analogue pins are used for I2C comms, two are used for monitoring voltage and two more are used for a rotary encoder.

I'd like one more pin to connect a simple push button to.

Thanks.

INTP

LCD could be moved to I2C with a backpack, but it's not completely off limits to use pin 0/1 if you don't need them while uploading sketches.

Fulliautomatix

Ok, more details for you guys. The device is actually an automated servo tester, the screen, rotary encoder and the new button I want to add are just there to navigate a series of menu options before the tests begin (select the servo type, the amount of logging and the test program etc). Once the menu options have been selected the button is no longer required.

Bearing this in mind, does this mean that I could connect one pin to both a servo and a push button at the same time? Initially the digital pin can be setup as an input, and used up to the point the testing starts, at which point it's re-configured as an output pin used to control a servo?

Isaac96

That would work as long as you don't press the button while testing.
You could use a shift register for the LCD.
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

Fulliautomatix

Quote
You could use a shift register for the LCD.
Sorry, can you elaborate please? The libraries i've come across so far all use 6 pins for writing to the LCD


Isaac96

Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

Delta_G

#12
Aug 24, 2016, 11:14 pm Last Edit: Aug 24, 2016, 11:18 pm by Delta_G
Sorry, can you elaborate please? The libraries i've come across so far all use 6 pins for writing to the LCD


This library REBL_UI does a lot of other things, but it also includes an LCD run from a shift register using the SPI bus. It only uses 4 pins.

Here's the schematic  Ignore the button and encoder in the bottom right.

Here is a version of LiquidCrystal library that is set up to use it like that:https://github.com/delta-G/LiquidCrystal_SPI_8Bit

See the documentation in the Github page in the first link for more information. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy