I am interested in starting a new project based on the Mini Maestro to automate the orientation of arcade joysticks from 4 to 8 way.
The game contoller I’m using has the ability to power two LED lamps (driven by +5V to a current sink on the board), indicating whether a game is designed for 4 or 8 way operation. I would like to use these as analog inputs on the servo controller. My first question is, would it be better to have them power relays, so the servo controller sees them as a switch, or can they be connected directly?
I would like to use 4 pots (two for each joystick, player 1 and 2) for manually adjusting the trim on each servo position (joystick 4-way and 8way). So I see the need for 8 channels: 2 for servos, 4 for pots, and 2 for switches/relays.
I imagine the script logic working as follows:
-Wait for input from both relay switches
-When a switch is pressed, move each servo to the position set by its respective pot
-Go back to wait loop
However, the relay will stay latched the entire time a game is being played. Would there be any issues with this? It will unlatch when a game ends.
What do you mean by “LED lamp”? Is it just a single LED, or is it a lot of LEDs?
It is OK to directly connect any voltage between 0 and 5 V to the signal line of a Maestro channel. You will also need to connect the GND of the Maestro to the ground of your controller.
No, probably not. If you write your code correctly to respond to the inputs that it will receive, there should be no issues. You will have to learn some Maestro scripting, or program some other microcontroller to control the Maestro. Is there are particular issue you were worried about?
By LED lamp I mean a single LED. Each time a game is started, one or the other will light depending on the joystick orientation reqired (4 way or 8 way). I’m glad to hear I can connect directly to the inputs.
I was also concerned if there would be any scripting issues with the 5V signal staying active for the entire length of the game. As you say, I will have to learn the scripting language. Looking forward to starting some experiments!
I hadn’t considered that. It can drive at most 50mA. To simplify things I’ve decided to connect it directly to the Maestro input channels (no relay). However, when I was testing and applied 5V directly to a channel, all the channels set as inputs go high. Through reading the forum, I’ve realized the issue is caused by floating inputs. With some experimentation I noticed any inputs that are grounded stay low. Should I be adding a resistor on all the input channels between signal and ground? If so, what value do you recommend?
The lamp (LED) circuit for my controller specifies the following:
5VDC → 330ohm Resistor → LED → Lamp current sink
Can you suggest the best way to connect this directly to a Maestro input?
The code I came up with seems to work nicely so far:
#Wait for signal from controller
begin
signal_4way if move_4way endif
signal_8way if move_8way endif
repeat
sub signal_4way
2 get_position 512 greater_than
return
sub signal_8way
3 get_position 512 greater_than
return
# Move each servo to 4-way position.
sub move_4way
1000 # Player 1, 4 way position
4 times 0 servo
1000 # Player 2, 4 way position
4 times 1 servo
wait_for_game_to_end
return
# Move each servo to 8-way position.
sub move_8way
2000 # Player 1, 8 way position
4 times 0 servo
2000 # Player 2, 8 way position
4 times 1 servo
wait_for_game_to_end
return
# Wait for game to end.
sub wait_for_game_to_end
begin
2 get_position
512 less_than
3 get_position
512 less_than
logical_and
if return endif
repeat
No. If you configure a channel as an input then you should either connect something to it (so it is not floating) or ignore the value from it, because it is floating and the value doesn’t mean much. In some cases you would want to add a 1-10k pull-up or pull-down resistor to an input that you are going to be reading to guarantee that it doesn’t float, but I don’t think that is needed here.
You just need to find some point where the voltage changes noticeably when the LED is on, and connect that point to the Maestro. I think that the best point would be between the LED and the “Lamp current sink”. Try measuring it with a multimeter before connecting it to the Maestro. I expect it to be 0 V when the LED is on and ~3-5 V when the LED is off.
@David I’ve managed to get everything running just like I wanted. I’m amazed the Maestro is as easy to use as it is… even for a noob like me! Thank you so much for all the help!