Control a Espruino board with a gamepad

Posted on
  • Hello,

    I would like to make a robot with a Espruino board and control it with a bluetooth gamepad (e.g. PS4 dualshock controller or practically any HID device).

    What would be the easiest way to make controlling work?

    I have read that a USB host shield and a Bluetooth dongle can be used to achieve this goal, but is there any cleaner solution, e.g. some Bluetooth module that can work as a HID host?

    Best regards
    Kari Surakka

  • Hi!

    For standard Bluetooth you might be able to find some firmware for an HC-05 bluetooth module, but I think it's unlikely. HC-05s can handle being a Bluetooth UART host, so I'd think it's possible that they could also be a HID host. It's just finding the firmware to do it :(

    I think you're right in that you'd need a USB host shield and a Bluetooth dongle - and even then I'd double-check because to me it seems like it would be more difficult than that.

    However, you can also get Bluetooth LE controllers (be careful though - I just had a quick look on eBay and found a few that appeared to be mis-advertised), and if you're using those then something like Puck.js could communicate directly with them over BLE.

  • Hello,

    Thank you for your fast answer. I did some searching and I think that these would meet requirements:­oard-v2 and­4-dongle

    That board can be ordered with preinstalled PS3/4 firmware and gamepad data can be read from a serial output. Do you think it would work?

    Best regards
    Kari Surakka

  • Hello Kari @user80672,

    To clarify, which Espruino board are you intending to use? ref #1 above

    "I would like to make a robot with a Espruino board . . . "

    Will you be using I2C to communicate with the Espruino board? Is this what you had in mind?­ntroller-bluetooth

    Make sure the Bluetooth adapter supports BLE if communicating with the Puck.

    This article implies ver 4.1 is required for BLE:­ation.pdf

    p.5 "But: not backward compatible with Bluetooth Classic (including Bluetooth 4.0 Classic)"

    but, . . .

    " then something like Puck.js could communicate directly with them over BLE. " #2 above

    @Gordon Does the Puck support Bluetooth LE 4.0 ? (yes?) - BLE 4.1 ? (?)

    Features section doesn't specify, but both references are used on the page

    and to add to the confusion wikipedia indicates 'Bluetooth_4.1'­Low_Energy­Bluetooth_4.1

    This helps in Bluetooth version clarification­differences-between-Bluetooth-4-0-4-1-an­d-4-2-in-the-Layers-Baseband-LMP-L2CAP-a­pp-Layer

    " The job of Bluetooth 4.1 is to drive the ‘Internet of Things’ "
    " Bluetooth 4.1 devices can act as both hub and end point simultaneously "

  • Hello Robin,

    I have an original Espruino board and a micro one, not yet a Puck.

    And yes, I think I could utilise this:­ntroller-bluetooth

    My plan is like this:

    1. My Espruino uses serial connection to communicate with a USB host board
    2. The USB host board communicates with a Bluetooth dongle
    3. The Bluetooth dongle communicates with a PS4 controller

    I don't have to care about step two and three but I'm only guessing that I'm able to do step one. I'm a total beginner with these things, so please let me know if I'm guessing wrong.

    Best regards
    Kari S

  • Thank you Kari @user80672, your explanation clarifies you understand which module will do what.

    Although I don't have practical experience with the USB host controller, your plan appears sound to me.

    Are you at a point where you are comfortable in creating a communication language between the two devices, or are you still searching for modules that may cut down on development time? I think it would be a challenge and a load of fun creating a language for the robot. Something unique and one could be proud of when done.

    As a thought would you post 'as you go' pictures in the 'Projects' forum­/
    so that new members can get some ideas based on your efforts? Would love to see the progress at each step.

    Good luck and have fun!!

  • Hello,

    And thank you for encouraging words. I will share information about the progress.

    Best regards
    Kari S

  • Hi Kari,

    That all looks great to me! Serial or I2C should work just fine, with any Espruino board.

    I'm not quite sure what you'd be doing on the Espruino, but if you're controlling neopixels you'd want to use I2C (not Serial) as Espruino turns interrupts off during neopixel transmission and that can cause you to lose some serial data.

    If you have any questions when you get the parts just let us know though!

    Hope that helps!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Control a Espruino board with a gamepad

Posted by Avatar for user80672 @user80672