Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: blackbeard on October 19, 2010, 12:30:30 PM

Title: arduino RX/TX pins usable for digital output
Post by: blackbeard on October 19, 2010, 12:30:30 PM
so i've googled mixed messages about this. here is what i want to do. i want to use these pins for my pin heavy led cube with my 2 74hc4051 dmux. the standalone atmega328 will be used in this project and there will be no serial port attached as the chip will be programmed prior to being placed in the led cube motherboard. on one side i have heard that it is possible provided there is no other connection to the rx/tx pins but i've also found people saying that it's like a crime against humanity to use them. so keeping in mind that they will remain open otherwise and that i will shoot the next person even thinking of the word "charlieplexing" will this work?
Title: Re: arduino RX/TX pins usable for digital output
Post by: madsci1016 on October 19, 2010, 02:30:40 PM
Yes, you can use the RX/TX pins as regular IO. Just don't call the Serial.begin() in your code, and make sure you call a pinMode() for them.

You can also use the 6 ADC pins as another 6 digital IO pins as well. (digital pins 14-19)
Title: Re: arduino RX/TX pins usable for digital output
Post by: Soeren on October 19, 2010, 05:22:17 PM
I'm sure madsci thought "charlieplexing" there for a split second    :P  ;D ;D ;D
Title: Re: arduino RX/TX pins usable for digital output
Post by: madsci1016 on October 19, 2010, 05:27:52 PM
I'm sure madsci thought "charlieplexing" there for a split second    :P  ;D ;D ;D

 ::) ::) ::) ::)

Trying to get me shot huh?

If anything I was thinking 'shifting', as that's what I'm doing on Arduquee. Charlieplexing has to many cons to be useful IMHO.
Title: Re: arduino RX/TX pins usable for digital output
Post by: Soeren on October 19, 2010, 05:42:22 PM
Hehe, nope, but tell a person not to think of eg. the word "banana" and that will be the very image that will pop up in his/hers mind  :)

I challenge you to not think the word banana while you read this  ::)

(http://blogs.pitch.com/fatcity/banana.jpg)
Title: Re: arduino RX/TX pins usable for digital output
Post by: madsci1016 on October 19, 2010, 05:46:16 PM
Hehe, nope, but tell a person not to think of eg. the word "banana" and that will be the very image that will pop up in his/hers mind  :)

Has anyone introduced you to The Game (http://en.wikipedia.org/wiki/The_Game_%28mind_game%29)?

And yes, I just lost.
Title: Re: arduino RX/TX pins usable for digital output
Post by: Soeren on October 19, 2010, 06:23:04 PM
No, never heard of it before - more or less it started (for me) with an episode of The Persuaders, where somebody would set of something bad by thinking of an elephant - and as soon as you tell people not to, it's what gets focus of course.

Strange thing really, but it goes to illustrate how little we are in control of our own minds, when push comes to shove.
Perhaps a good thing to keep in mind, whenever we try to replicate ourselves through robotics.
Title: Re: arduino RX/TX pins usable for digital output
Post by: blackbeard on October 19, 2010, 07:38:35 PM
No, never heard of it before - more or less it started (for me) with an episode of The Persuaders, where somebody would set of something bad by thinking of an elephant - and as soon as you tell people not to, it's what gets focus of course.

Strange thing really, but it goes to illustrate how little we are in control of our own minds, when push comes to shove.
Perhaps a good thing to keep in mind, whenever we try to replicate ourselves through robotics.


we need to model AI after our lazy people. not enjoying mindless labor even if we need it to survive is what makes us human
Title: Re: arduino RX/TX pins usable for digital output
Post by: madsci1016 on October 19, 2010, 08:29:32 PM
Back on topic,

Yes, you can use the RX/TX pins as regular IO. Just don't call the Serial.begin() in your code, and make sure you call a pinMode() for them.

You can also use the 6 ADC pins as another 6 digital IO pins as well. (digital pins 14-19)

Did this help?
Title: Re: arduino RX/TX pins usable for digital output
Post by: blackbeard on October 20, 2010, 06:59:09 AM
I'm sure madsci thought "charlieplexing" there for a split second    :P  ;D ;D ;D

 ::) ::) ::) ::)

Trying to get me shot huh?

If anything I was thinking 'shifting', as that's what I'm doing on Arduquee. Charlieplexing has to many cons to be useful IMHO.


allot of people have been mentioning shifting but wouldn't that be really slow? i mean you'd have to wait for 20 inputs to be input into the register before enabling it and displaying the 1 led. you could do more then one led but my understanding is that leds don't play nice together in parallel without a resistor on each of them. multiplexing seems to be working pretty well for me right now and i've already soldered the chips in but i might try a shift register next time
Title: Re: arduino RX/TX pins usable for digital output
Post by: madsci1016 on October 20, 2010, 07:59:16 AM
This is through 'shifted multiplexing'

Society of Robots Line Dancers (http://www.youtube.com/watch?v=c-9x0Fl7Gi8#)

Arduquee, a Arduino powered Marquee; first words (http://www.youtube.com/watch?v=DMQyje3y1hg#)

using only 6 IO pins, soon to be 5; for displays up to 10 8x8 matrices long. (1280 LEDs)

It works for me, but you can't do PWM brightness control on the LEDs.
Title: Re: arduino RX/TX pins usable for digital output
Post by: blackbeard on October 22, 2010, 09:50:32 PM
thanks! i was wondering since i havn`t used the rx and tx pins if it would work if i connected the RX/tx pins to the rx/tx pins on the arduino in order to program it without removing the chip each time.
Title: Re: arduino RX/TX pins usable for digital output
Post by: Soeren on October 24, 2010, 07:53:50 AM
Hi,

allot of people have been mentioning shifting but wouldn't that be really slow? i mean you'd have to wait for 20 inputs to be input into the register before enabling it [...]
Slow is a relative term, of course, but if the clock is eg. 200 kHz, it would take 100µs, or IOW, you could do it around 10,000 times a second (not counting strobing it through and such house keeping). With a multiplexed display, depending on the duty cycle, you should be quite fine with an update rate of around 100..200Hz.