Part 3: Program and procedure

Posted on by 0 comment

As already mentioned, the heart is a Raspberry Pi 3. The built-in Bluetooth module is handy and can be paired with a Wiimote. 
Operating system is the current Raspbian, and Python version 2.x is used, since the used Wiimote library does not work with version 3.x. 
Ah yes, a tutorial about how to install the library and how to connect the Wiimote is available on this page , for example. Of course, with the Pi 3 you can skip the installation of a Bluetooth dongle.

Here is a section of the Python program:

 while True:

    buttons = wii.state['buttons']

  #Achtung: WiiMote wird quer gehalten, deshalb RIGHT --> Vorwaerts
    if(buttons & cwiid.BTN_RIGHT):
      if(buttons & cwiid.BTN_DOWN):     #DOWN --> rightfor
        Drive_rightfor()
      elif(buttons & cwiid.BTN_UP):     #UP --> leftfor
        Drive_leftfor()
      else:
        Drive_forward()      
    elif(buttons & cwiid.BTN_LEFT):     #LEFT --> Rueckwaerts
      if(buttons & cwiid.BTN_DOWN):     #DOWN --> rightback
        Drive_rightback()
      elif(buttons & cwiid.BTN_UP):     #UP --> leftback
        Drive_leftback()
      else:      
        Drive_back()
    else:
      if(buttons & cwiid.BTN_UP):       #UP --> leftturn
        Drive_leftturn()
      elif(buttons &cwiid.BTN_DOWN):    #DOWN --> rightturn
        Drive_rightturn()
      else:
        Drive_stop()
    time.sleep(0.1)

#Turm drehen mit 1 und 2
    if(buttons & cwiid.BTN_1):
      Turn_left()
    elif(buttons & cwiid.BTN_2):
      Turn_right()
    else:
      Turn_stop()
    time.sleep(0.1)

#Turm heben mit + und -
    if(buttons & cwiid.BTN_PLUS):
      Lift_up()
    elif(buttons & cwiid.BTN_MINUS):
      Lift_down()
    else:
      Lift_stop()
    time.sleep(0.1)

#Band und Bagger
    if(buttons & cwiid.BTN_A):
      if(pressed == '0' and run == 'stop'):
        Band_run()
        pressed = 'A'
      elif(pressed == '0' and run == 'run'):
        Band_stop()
        pressed = 'A'
    else:
      pressed = '0'
    
    time.sleep(0.1)

....

And here is the layout of the Wiimote:

Because no monitor and no keyboard will be plugged into the Pi, the program must start automatically. The Status LED, which is always blue when power is on, flashes red briefly when the Wiimote can be paired (simultaneous pressing 1 and 2). If the pairing is successful, the green LED is additionally lit. 
If the pairing is unsuccessful, the program terminates, but Pi remains on. 
After the pairing has been completed, you can play with the excavator. 
If you have finished, separate the Wiimote with the Home button. Then the Pi shut down. Holding the B button (on the back) while pressing Home will close the connection. The Pi does not shut down.

Last part: it works!

Last part: it works!

Posted on by 0 comment

Finally two more videos:

Video 1: Start and switch off the Raspberry Pi 3 (approx. 56 s)

 

Video 2: Functional presentation (approx. 3 min)

 

Postscript

The bucket wheel excavator from Lego Technic 42055

Posted on by 0 comment

Finally! I got the bucket wheel excavator from Lego as a birthday gift.

To build it was great, but of course I was not satisfied. Just one engine that drives everything, oh really!

That’s why I have modified the bucket wheel excavator so that all previously driven functions can be independently controlled by remote control. In addition, it is now also steerable and the bucket wheel can also be lowered by motor.

Pictures, video and description will be available soon.

From the original to the modified version

Ich benutze Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu. Wenn Du keine Cookies möchtest, deaktiviere sie bitte im Browser.