Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Maestro voice control code

Hi there.
I need some real 101 help here. I would like to set up a geeetech voice control module to simply start and stop my script. I have no idea where to start. The examples I have read just confused me as I fundamentally do not understand what code needs to be sent and what code needs to be received and how that code needs to be written. Below is all the info I have gone through. Any help from anyone would be greatly appreciated.

After setting up the geeetech voice control module ( check out link 1 and link 3)
I need to program the Pololu maestro to send a hex code to start and run script so that the voice control module boots up. As you can see the arduino code example in link 2
Then like before I need the code on the pololu maestro to wait for either the button push or hex code from the voice control module to then run the rest of the script. .
Under is the script I’m trying to write but I know its all kinds of messed up.
I know I’m asking a lot here so I appreciate any help I can get.
thank you all
Justin

  1. http://www.geeetech.com/wiki/images/6/69/Voice_Recognize_manual.pdf
  2. http://www.geeetech.com/wiki/index.php/Arduino_Voice_Recognition_Module
  3. https://www.youtube.com/watch?v=965x8CKs5vQ&t=504s
  4. https://www.pololu.com/docs/0J40/5.e
# SOFA BEER FRIDGE CODE
main_loop:  
begin  
2000 delay   # This is the code that they used to talk to the arduino so of course it is wrong
0xAA serial_send_byte   # i don't understand what i the maestro needs to see. I think im missing a lot
0x37 serial_send_byte
1000 delay
0xAA serial_send_byte
0x21 serial_send_byte

3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
wait_for_button_closed_10ms
while       #wait for Voice control module to return a hex command to run the script)

0x12 serial_return_byte #this code is wrong but I have no idea what it is looking for here.

1 get_position 500 greater_than if load_beer else normal_deliver endif  #check proximity sensor if beer is in the delivery draw
repeat

### Sequence subroutines: ###

sub load_beer
8000 frame_5 # Frame 5 start despencing motor (ready beer in delivery draw)
10  
begin
dup
while
1 get_position 500 less_than if goto normal_delivery endif
1000 delay
1 minus
repeat
drop
3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
return quit
 
normal_delivery:
drop
3986 3986 3986 frame_3..5
1000 delay
8000 frame_3# Frame 1 start draw deliver
8
begin
dup
while
1 get_position 500 greater_than if goto skip_removed endif
1000 delay
1 minus
repeat
drop
3986 frame_3 # Frame 2 stop draw deliver
1000 delay  
8000 frame_4 # Frame 3 start draw return
10
begin
dup
while
2 get_position 500 less_than if goto skip_drawreturn endif
1000 delay
1 minus
repeat
drop
3986 frame_4 # Frame 4 stop draw return
1500 delay
8000 frame_5 # Frame 5 start despencing motor (ready beer in delivery draw)
10
begin
dup
while
1 get_position 500 less_than if goto main_loop endif
1000 delay
1 minus
repeat
drop
3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
return quit


sub normal_deliver
drop
3986 3986 3986 frame_3..5
1000 delay
8000 frame_3# Frame 1 start draw deliver
8
begin
dup
while
1 get_position 500 greater_than if goto skip_removed endif
1000 delay
1 minus
repeat
drop
3986 frame_3 # Frame 2 stop draw deliver
1000 delay  
8000 frame_4 # Frame 3 start draw return
10
begin
dup
while
2 get_position 500 less_than if goto skip_drawreturn endif
1000 delay
1 minus
repeat
drop
3986 frame_4 # Frame 4 stop draw return
1500 delay
8000 frame_5 # Frame 5 start despencing motor (ready beer in delivery draw)
10
begin
dup
while
1 get_position 500 less_than if goto main_loop endif
1000 delay
1 minus
repeat
drop
3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
return quit


 
skip_removed:
drop
3986 frame_3 # Frame 2 stop draw deliver
1000 delay  
8000 frame_4 # Frame 3 start draw return
10
begin
dup
while
2 get_position 500 less_than if goto skip_drawreturn endif
1000 delay
1 minus
repeat
drop
3986 frame_4 # Frame 4 stop draw return
1500 delay
8000 frame_5 # Frame 5 start despencing motor (ready beer in delivery draw)
10
begin
dup
while
1 get_position 500 less_than if goto main_loop endif
1000 delay
1 minus
repeat
drop
3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
return quit


skip_drawreturn:
drop
3986 frame_4 # Frame 4 stop draw return
1500 delay
8000 frame_5 # Frame 5 start despencing motor (ready beer in delivery draw)
10
begin
dup
while
1 get_position 500 less_than if goto main_loop endif
1000 delay
1 minus
repeat
drop
3986 3986 3986 frame_3..5 # Frame 0 (ensure all motor switches to open)  
return quit

   
     
sub frame_3..5
  5 servo
  4 servo
  3 servo
  return

sub frame_3
  3 servo
  return

sub frame_4
  4 servo
  return

sub frame_5
  5 servo
  return
 

#START SWITCH

# Wait for the button to be pressed for at least 10 ms.
sub wait_for_button_closed_10ms
  get_ms
  begin
    # reset the time on the stack if it is not pressed
    0 get_position 500 less_than
    if
      get_ms over minus 10 greater_than
      if drop return endif
    else
      drop get_ms
    endif
  repeat


#PROXIMITY SWITCH
 
# Wait for the button to be pressed for at least 10 ms.
sub wait_for_button1_closed_10ms
  get_ms
  begin
    # reset the time on the stack if it is not pressed
    1 get_position 500 less_than
    if
      get_ms over minus 10 greater_than
      if drop return endif
    else
      drop get_ms
    endif
  repeat

sub wait_for_button1_open_10ms
  get_ms
  begin
    # reset the time on the stack if it is not pressed
    1 get_position 500 greater_than
    if
      get_ms over minus 10 greater_than
      if drop return endif
    else
      drop get_ms
    endif
  repeat

#LIMIT SWITCH

# Wait for the button to be pressed for at least 10 ms.
sub wait_for_button2_closed_10ms
  get_ms
  begin
    # reset the time on the stack if it is not pressed
    2 get_position 500 less_than
    if
      get_ms over minus 10 greater_than
      if drop return endif  
    else
      drop get_ms
    endif
  repeat

Hello.

A Maestro script can be used to send serial bytes, but it cannot be used to process incoming serial bytes.

If you can set up your system to send the Maestro a specific command when it is ready, you might be able to make it work by using one of the “Serial Script Commands”, such as “Restart Script at Subroutine”. Alternatively, if your voice recognition module can output a digital high or low signal when it is ready, you could use a Maestro channel configured as an input to monitor that as if it were a button or switch.

I am not very familiar with that Geetech Voice Recognition Module, but from skimming through the manual you posted, it does not look like either of those would be an option for you.

If you want to process the serial data returned from the voice recognition module, you might need to add a separate microcontroller such as an Arduino or one of our A-Star programable controllers.

Brandon