Wiimote Controlled RPi Robot

Wiimote RPi Robot

[Brian] has brought together a powerful collection of hardware to build a robot. The end goal is to have a robot that’s controlled by a Wiimote.

The Wiimote communicates over Bluetooth with a Raspberry Pi, which is running a Python script. This script uses the CWiid Python module to communicate with the controller, and [Brian] has detailed instructions on getting the Wiimote working with a RPi. The RPi controls an ATmega based development board over SPI, which drives an h-bridge to control the two DC motors that move the robot.

[Brian]‘s code for this could be helpful for anyone looking to control their RPi with a Wiimote. Since Wiimotes and Bluetooth dongles are fairly cheap nowadays, this is a great way to drop in wireless control to any RPi project, or even to control your media center from the couch.

After the break, check out a video of the build in action

Comments

  1. hemalchevli says:

    Why us the micro-controller, connect the H-bridge (IC L293d) and use soft PWM on gpio(https://projects.drogon.net/raspberry-pi/wiringpi)

  2. medix says:

    Can someone explain why this wasn’t implemented entirely on the RPi without the secondary ATMeaga board? I was under the impression that the RPi board has more than enough processing power to provide PWM. This seems like a bit of an odd way to go about things..

    • medix says:

      Found this in another post:

      “Since the Raspberry doesn’t have the number of PWM signals I need to control i’m going to do so through SPI.”

      Perhaps for additional I/O as well? I was under the impression that the RPi had more general I/O than that.

    • medix says:

      I think what’s missing here is an overview of the general goals of the project. There doesn’t seem to be any description of the purpose, or exactly *why* more GPIO pins are needed. Without this info, it just seems like overkill. ;)

    • Cynar says:

      IT might be down to timing issues. Linux is not ‘real time’ this can either mess up the functionality of some things that are timing critical, or require a lot more coding complexity to make sure nothing interrupts the time critical code.

      The AVR is bear metal work, so it’s a lot easier to keep timings accurate, and just pass the data back and forth via the hardware level controllers (SPI in this case).

      • harold ite says:

        The timing issue is interesting. I wonder if this has been properly tested. Does the timing depend on the amount of processing the RasPi is doing, or is it always a problem? What time scale are PWM signals on?

    • andres says:

      i suppose he’s just using what he has available to get his project done. the most elegant way, no. but hey, when you have stuff laying around, why not use it.

  3. Rob says:

    Surely if you can keep a quadcopter in the air without a RTOS, then a robot should be a doddle.

    http://hackaday.com/2012/12/01/raspberry-pi-quadcopter/

  4. Rower says:

    K’nex FTW!

  5. Tom says:

    Did that quite a while ago already :]

  6. biozz says:

    i use a wiimote for my raspi XBMC XP

    but to someone elses comment can the raspi even do software PWM?
    i thought the os was *insert word im thinking of for read-do-read-do here* and cant do tasks like that

    • medix says:

      I’ve never used it, so I didn’t know either. I managed to find some info online for software modules that will provide PWM, but I didn’t look into it further.

    • It can, but since it has to do it in software, it decreases the amount of CPU left over for other tasks. An additional MCU is very inexpensive, so there’s no compelling reason not to use one to perform realtime tasks so you don’t have to do it through brute force on the Raspi — leaving it unloaded to perform any intensive processing tasks you might have in mind.

      • biozz says:

        Yeah i never found any trouble with hooking up an arduino or atmega32 and the SPI buss … or even USB tho i have not yet played with that
        especially because i have the suspicion the software PWM might be unstable … thinking about the dynamic scaling of the CPU and background tasks … afterall if i was not after heavy background tasks i would not have used a f**king computer XP

    • rasz says:

      Afaik you can setup dma transfer on gpio = no cpu cycles burned

  7. JoeJoeBoom says:

    I was wondering if this could be done with simple continuos rotation servos that have a built in h-bridge? I have a model b pi and cant wait to do some stuff with it

  8. there are bt chips and stacks that can run entirely on an atmel chip. *why* do we need thousands of MIPS of extra computing power here? for “blog cred?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,449 other followers