Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: dellagd on June 05, 2009, 05:46:17 AM

Title: OSCAR - user input mod
Post by: dellagd on June 05, 2009, 05:46:17 AM
ok, I dropped the idea of a PC to I2C mod, now its a user interface mod. it will have transistors, switches  and pots, if MCUs can read resistance, or if I put 5 volts into it, voltage? also can I temporarily use a robuniuo, aka does a robuniuo have I2C connection spots.

it will work like if pin a becomes high, it sends the bit 3 to mod 12214352. that bit may turn a servo or turn on a led
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 05, 2009, 06:00:51 AM
yes, roboduino has i2c.
it will take over analogue inputs 4 and 5 and has optional pup resistors.
Title: Re: OSCAR - user input mod
Post by: chelmi on June 05, 2009, 11:57:34 AM
It would be nice to have the user input module on the same board as the lcd. This way you can create nice user interfaces with menus etc.
You can also look at mini joysticks like this : http://www.anglia.com/newsarchive/834.asp?article_id=1647 (http://www.anglia.com/newsarchive/834.asp?article_id=1647)
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 05, 2009, 03:23:24 PM
yes, just recently i have been experimenting with things just like that...
i ripped the joysticks out of my ps2 controller...
Title: Re: OSCAR - user input mod
Post by: dellagd on June 06, 2009, 11:17:39 AM
here is kind a rough outline of what it will do. there is 4 loggle switches and a pushbutton switch on a spring. w/ the 4 toggles you can make 10+ combinations of the pin is HIGH or LOW. Then when you push the pushbutton, it executes a command based on what combination the toggles are on. then it waits like 2 seconds so when you press the button it doesnt do the command 5 times. In the schematic I left out the I2C connections, ect.
it was just to illustrate my point.
Title: Re: OSCAR - user input mod
Post by: Ro-Bot-X on June 06, 2009, 12:34:05 PM
Dellagd,

If you want us to see the schematic, please attach it as an jpg or png image. This way it's easy to see imediatelly, without the need of downloading, saving, open it in Eagle.

About the joystick, instead of using 5 pins from the microcontroller, use an analog pin and tie the switches with different resistors in series, so each time a switch is pressed, a different voltage is sampled. I'll attach a schematic latter this evening..
Title: Re: OSCAR - user input mod
Post by: dellagd on June 06, 2009, 02:14:40 PM
k thanks, I'm a little confused on those last sentences
also, about thy joystick thing, it only has 5 positions, so thats only 5 different combonations. with the switches you get 10+
if I do joystick, me and airmans mods might work in unicin, like a navigation menu.
unless when you explain it better it appeals to me more, I'm sticken with switches.
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 06, 2009, 04:35:08 PM
when you are doing up a schematic don't forget the necessary this like pup resistors...
in your drawing the switches would be floating which means they would sorta stutter from on to off.
attach pups like in the picture but depending on whether you want to set the pin high for on or low for on.
Title: Re: OSCAR - user input mod
Post by: dellagd on June 06, 2009, 04:37:12 PM
sry smash but what is a pup resistor or whatever?
Title: Re: OSCAR - user input mod
Post by: Ro-Bot-X on June 06, 2009, 04:46:19 PM
Here is a project LCD shield for Arduino/Roboduino. It has push buttons arranged like the arrow keys on the PC keyboard plus a select button. You can find there the code and the schematic.
http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=2 (http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=2)

Actually, I'll link the schematic for faster reference, to see what I'm talking about using resistors in series and tie all buttons to an analog pin:
http://www.nuelectronics.com/download/projects/LCDshield_v1_1.pdf (http://www.nuelectronics.com/download/projects/LCDshield_v1_1.pdf)
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 06, 2009, 04:48:26 PM
pups are pull up resistors, they stop a floating input from floating.

so when the switch is not engaged instead of being at an unknown state it will either be high or low depending on whether you pull up or pull down the line.
Title: Re: OSCAR - user input mod
Post by: Razor Concepts on June 06, 2009, 05:14:04 PM
pull up resistors are not required. Even if the line is floating, bit_is_clear() will still return false because it is not grounded.
Title: Re: OSCAR - user input mod
Post by: dellagd on June 07, 2009, 04:58:05 PM
thats what I wan thinking...
Title: Re: OSCAR - user input mod
Post by: chelmi on June 07, 2009, 05:27:13 PM
pull up resistors are not required. Even if the line is floating, bit_is_clear() will still return false because it is not grounded.

 ??? This is the first time I hear the a pull up/down resistor is not needed for an input switch. It depends on the type of device your are connecting your switch to.
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 07, 2009, 05:34:44 PM
pull up resistors are not required. Even if the line is floating, bit_is_clear() will still return false because it is not grounded.

 ??? This is the first time I hear the a pull up/down resistor is not needed for an input switch. It depends on the type of device your are connecting your switch to.
i always thought they were needed for any type on mechanical switch if you had an I/O pin on the other end?
Title: Re: OSCAR - user input mod
Post by: dellagd on June 07, 2009, 06:21:59 PM
ok explain this pup resister thing to me better.
Title: Re: OSCAR - user input mod
Post by: Razor Concepts on June 07, 2009, 06:33:28 PM
My bad, I guess I didn't explain it clear enough. A pull up resistor is required, but you dont need to add it - AVRs have a built it one that can be enabled.

Here is what an external pull up resistor would look like, for microcontrollers that don't have one inside.
(http://www.scienceprog.com/wp-content/uploads/AVRBUTT/external_pull_up.gif)
AVRs have an internal pullup that can be enabled, like this
(http://www.scienceprog.com/wp-content/uploads/AVRBUTT/internal_pull_up.gif)

To enable the internal pull up, set the port as input and write a digial high to it. For example if you are using arduino it would be

pinMode(1,INPUT);
digitalWrite(1,HIGH);
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 07, 2009, 06:39:13 PM
ahh yes, i forgot about the internal pup resistors!
my bad razor, thanks for that.
Title: Re: OSCAR - user input mod
Post by: dellagd on June 07, 2009, 06:50:58 PM
and roboduino uses that same code?
Title: Re: OSCAR - user input mod
Post by: SmAsH on June 07, 2009, 06:52:29 PM
yes, but it may be different if you are writing in arduino but pretty much the same.