1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Esp32 BLE Wireless wheel

Discussion in 'DIY peripherals' started by Chris_Beeves, Jul 6, 2020.

  1. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    On my hoverboard wheel I have been trying to make the wheel wireless using an esp32. I now have it working, but something makes it disconnect and connect again every thirty seconds or so. Does anybody else have this problem?

    24E7EAEE-0A11-4F67-9F8F-4C24C626B197.jpeg

    I’m thinking it could be the receiver, but I’m not sure.
    • Disagree Disagree x 1
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    @Chris Malcolm , is there a reason you disagree, or just a misclick?
  4. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Ok, so it turns out it was my Bluetooth USB dongle that was causing problems. Bought an Asus usb-bt500 and now it works like a charm!
    • Like Like x 2
  5. Chris Malcolm

    Chris Malcolm New Member

    Joined:
    Mar 9, 2019
    Messages:
    24
    Balance:
    252Coins
    Ratings:
    +9 / 0 / -0
    Whoops, that was a misclick. :(
    • Like Like x 1
  6. Hardsteel73

    Hardsteel73 Hardsteel73

    Joined:
    Nov 28, 2011
    Messages:
    53
    Occupation:
    Self employed
    Location:
    bergschenhoek
    Balance:
    162Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    2DOF
    Is the a public available scheme so I can make that too. And would rev lights be possible like amstudio made?
  7. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    The code I use doesn’t have leds. I stripped it down to only buttons.
  8. Hardsteel73

    Hardsteel73 Hardsteel73

    Joined:
    Nov 28, 2011
    Messages:
    53
    Occupation:
    Self employed
    Location:
    bergschenhoek
    Balance:
    162Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    2DOF
    I understand but where can I find the plans for that? And could it be expanded with rev lights and encoders, you think?
  9. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    My code was built on the same repo this guy built on, but he added encoder support:

    https://github.com/manoukianv/SteeringWheelBluetooth

    I have no idea how to make rev lights. If I would try to do it, I'd look if I could find some arduino solution that could do it today, and try to figure out how to paste it into the code above..
    • Like Like x 1
    • Friendly Friendly x 1
  10. Hardsteel73

    Hardsteel73 Hardsteel73

    Joined:
    Nov 28, 2011
    Messages:
    53
    Occupation:
    Self employed
    Location:
    bergschenhoek
    Balance:
    162Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    2DOF
    Hey thanks a lot!
    • Like Like x 1
  11. mm982566

    mm982566 New Member

    Joined:
    Sep 22, 2017
    Messages:
    23
    Location:
    广东东莞
    Balance:
    115Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    3DOF
    This is kind of interesting, and it's up to 32 buttons now, So I think I should give it a try, thanks
  12. miaziol

    miaziol New Member

    Joined:
    Dec 20, 2020
    Messages:
    1
    Balance:
    - 44Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Arduino
    Hello is any wiring plan for it? For wich one pin button and encoders are connected? Sorry for my English.
  13. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Hello!
    I believe not. It is quite easy to figure out though if you look into the .ino file.
  14. Pino Pistolidas

    Pino Pistolidas New Member Gold Contributor

    Joined:
    Mar 16, 2018
    Messages:
    21
    Location:
    Netherlands nijkerk
    Balance:
    227Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I managed to make a button box with up till 19 buttons with the Wemos Lolin32 lite. And this works well.
    I now tried to make one with 3 rotary encoders but this isn't working proparly.
    So let's say button 15 and 16 are on one encoder and they both flash if I turn the encoder clockwise and also if I turn the encoder counter clockwise.
    I see the guy from https://github.com/manoukianv/SteeringWheelBluetooth has rotary encoders working but I can find his sketch.

    So I ended up modifying the "SingleButton" example.

    Does anybody have the right sketch from manoukianv or a suggestion how to connect or program the correct way for the rotary encoders?



    Here is my sketch::blush

    /*
    * A simple sketch that maps a single pin on the ESP32 to a single button on the controller
    */

    #include <BleGamepad.h>

    BleGamepad bleGamepad;

    int previousButton1State = HIGH;
    int previousButton2State = HIGH;
    int previousButton3State = HIGH;
    int previousButton4State = HIGH;
    int previousButton5State = HIGH;
    int previousButton6State = HIGH;
    int previousButton7State = HIGH;
    int previousButton8State = HIGH;
    int previousButton9State = HIGH;
    int previousButton10State = HIGH;
    int previousButton11State = HIGH;
    int previousButton12State = HIGH;
    int previousButton13State = HIGH;
    int previousButton14State = HIGH;
    int previousButton15State = HIGH;
    int previousButton16State = HIGH;
    int previousButton17State = HIGH;
    int previousButton18State = HIGH;
    int previousButton19State = HIGH;

    void setup() {
    pinMode(13, INPUT_PULLUP);
    pinMode(15, INPUT_PULLUP);
    pinMode(2, INPUT_PULLUP);
    pinMode(0, INPUT_PULLUP);
    pinMode(4, INPUT_PULLUP);
    pinMode(16, INPUT_PULLUP);
    pinMode(17, INPUT_PULLUP);
    pinMode(5, INPUT_PULLUP);
    pinMode(18, INPUT_PULLUP);
    pinMode(23, INPUT_PULLUP);
    pinMode(19, INPUT_PULLUP);
    pinMode(22, INPUT_PULLUP);
    pinMode(12, INPUT_PULLUP);
    pinMode(14, INPUT_PULLUP);
    pinMode(27, INPUT_PULLUP);
    pinMode(26, INPUT_PULLUP);
    pinMode(25, INPUT_PULLUP);
    pinMode(33, INPUT_PULLUP);
    pinMode(32, INPUT_PULLUP);

    bleGamepad.begin();
    }

    void loop() {
    if(bleGamepad.isConnected())

    { int currentButton1State = digitalRead(13);

    if (currentButton1State != previousButton1State)
    {
    if(currentButton1State == LOW)
    {
    bleGamepad.press(BUTTON_1);
    }
    else
    {
    bleGamepad.release(BUTTON_1);
    }
    }
    previousButton1State = currentButton1State;
    }

    { int currentButton2State = digitalRead(15);

    if (currentButton2State != previousButton2State)
    {
    if(currentButton2State == LOW)
    {
    bleGamepad.press(BUTTON_2);
    }
    else
    {
    bleGamepad.release(BUTTON_2);
    }
    }
    previousButton2State = currentButton2State;
    }

    { int currentButton3State = digitalRead(2);

    if (currentButton3State != previousButton3State)
    {
    if(currentButton3State == LOW)
    {
    bleGamepad.press(BUTTON_3);
    }
    else
    {
    bleGamepad.release(BUTTON_3);
    }
    }
    previousButton3State = currentButton3State;
    }

    { int currentButton4State = digitalRead(0);

    if (currentButton4State != previousButton4State)
    {
    if(currentButton4State == LOW)
    {
    bleGamepad.press(BUTTON_4);
    }
    else
    {
    bleGamepad.release(BUTTON_4);
    }
    }
    previousButton4State = currentButton4State;
    }

    { int currentButton5State = digitalRead(4);

    if (currentButton5State != previousButton5State)
    {
    if(currentButton5State == LOW)
    {
    bleGamepad.press(BUTTON_5);
    }
    else
    {
    bleGamepad.release(BUTTON_5);
    }
    }
    previousButton5State = currentButton5State;
    }

    { int currentButton6State = digitalRead(16);

    if (currentButton6State != previousButton6State)
    {
    if(currentButton6State == LOW)
    {
    bleGamepad.press(BUTTON_6);
    }
    else
    {
    bleGamepad.release(BUTTON_6);
    }
    }
    previousButton6State = currentButton6State;
    }

    { int currentButton7State = digitalRead(17);

    if (currentButton7State != previousButton7State)
    {
    if(currentButton7State == LOW)
    {
    bleGamepad.press(BUTTON_7);
    }
    else
    {
    bleGamepad.release(BUTTON_7);
    }
    }
    previousButton7State = currentButton7State;
    }

    { int currentButton8State = digitalRead(5);

    if (currentButton8State != previousButton8State)
    {
    if(currentButton8State == LOW)
    {
    bleGamepad.press(BUTTON_8);
    }
    else
    {
    bleGamepad.release(BUTTON_8);
    }
    }
    previousButton8State = currentButton8State;
    }

    { int currentButton9State = digitalRead(18);

    if (currentButton9State != previousButton9State)
    {
    if(currentButton9State == LOW)
    {
    bleGamepad.press(BUTTON_9);
    }
    else
    {
    bleGamepad.release(BUTTON_9);
    }
    }
    previousButton9State = currentButton9State;
    }

    { int currentButton10State = digitalRead(23);

    if (currentButton10State != previousButton10State)
    {
    if(currentButton10State == LOW)
    {
    bleGamepad.press(BUTTON_10);
    }
    else
    {
    bleGamepad.release(BUTTON_10);
    }
    }
    previousButton10State = currentButton10State;
    }

    { int currentButton11State = digitalRead(19);

    if (currentButton11State != previousButton11State)
    {
    if(currentButton11State == LOW)
    {
    bleGamepad.press(BUTTON_11);
    }
    else
    {
    bleGamepad.release(BUTTON_11);
    }
    }
    previousButton11State = currentButton11State;
    }

    { int currentButton12State = digitalRead(22);

    if (currentButton12State != previousButton12State)
    {
    if(currentButton12State == LOW)
    {
    bleGamepad.press(BUTTON_12);
    }
    else
    {
    bleGamepad.release(BUTTON_12);
    }
    }
    previousButton12State = currentButton12State;
    }

    { int currentButton13State = digitalRead(12);

    if (currentButton13State != previousButton13State)
    {
    if(currentButton13State == LOW)
    {
    bleGamepad.press(BUTTON_13);
    }
    else
    {
    bleGamepad.release(BUTTON_13);
    }
    }
    previousButton13State = currentButton13State;
    }

    { int currentButton14State = digitalRead(14);

    if (currentButton14State != previousButton14State)
    {
    if(currentButton14State == LOW)
    {
    bleGamepad.press(BUTTON_14);
    }
    else
    {
    bleGamepad.release(BUTTON_14);
    }
    }
    previousButton14State = currentButton14State;
    }

    { int currentButton15State = digitalRead(27);

    if (currentButton15State != previousButton15State)
    {
    if(currentButton15State == LOW)
    {
    bleGamepad.press(BUTTON_15);
    }
    else
    {
    bleGamepad.release(BUTTON_15);
    }
    }
    previousButton15State = currentButton15State;
    }

    { int currentButton16State = digitalRead(26);

    if (currentButton16State != previousButton16State)
    {
    if(currentButton16State == LOW)
    {
    bleGamepad.press(BUTTON_16);
    }
    else
    {
    bleGamepad.release(BUTTON_16);
    }
    }
    previousButton16State = currentButton16State;
    }

    { int currentButton17State = digitalRead(25);

    if (currentButton17State != previousButton17State)
    {
    if(currentButton17State == LOW)
    {
    bleGamepad.press(BUTTON_17);
    }
    else
    {
    bleGamepad.release(BUTTON_17);
    }
    }
    previousButton17State = currentButton17State;
    }

    { int currentButton18State = digitalRead(33);

    if (currentButton18State != previousButton18State)
    {
    if(currentButton18State == LOW)
    {
    bleGamepad.press(BUTTON_18);
    }
    else
    {
    bleGamepad.release(BUTTON_18);
    }
    }
    previousButton18State = currentButton18State;
    }

    { int currentButton19State = digitalRead(32);

    if (currentButton19State != previousButton19State)
    {
    if(currentButton19State == LOW)
    {
    bleGamepad.press(BUTTON_19);
    }
    else
    {
    bleGamepad.release(BUTTON_19);
    }
    }
    previousButton19State = currentButton19State;
    }
    }
  15. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
  16. Pino Pistolidas

    Pino Pistolidas New Member Gold Contributor

    Joined:
    Mar 16, 2018
    Messages:
    21
    Location:
    Netherlands nijkerk
    Balance:
    227Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    That sketch looks much better indeed, but I'm missing some voodoo.
    I get an error message trying to upload this sketch to my lolin32 lite.
    Do I need to install some libraries first?
  17. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Are you using platformIO? Did you download the whole code?

    From what I can see by a glance, these are the includes;
    Code:
    #include <Arduino.h>
    #include <BleGamepad.h>
    #include "button.h"
    #include "battery.h"
    #include "encoder.h"
    
  18. Pino Pistolidas

    Pino Pistolidas New Member Gold Contributor

    Joined:
    Mar 16, 2018
    Messages:
    21
    Location:
    Netherlands nijkerk
    Balance:
    227Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    :blush Sorry I'm a noob, how do I use the platformIO?
  19. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    It has been a long time since I tried all this. I made my code in ArduinoIDE and lost touch with PlatformIO.
    You need to install Visual Studio CODE and PlatformIO, then download the github repo and run it in PlatformIO. As I recall it was quite self explanatory when it all was installed.
    Maybe you can find something here;

  20. Pino Pistolidas

    Pino Pistolidas New Member Gold Contributor

    Joined:
    Mar 16, 2018
    Messages:
    21
    Location:
    Netherlands nijkerk
    Balance:
    227Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I manged to get this working thanks for your help, but the encoders are chnaging the X and Y axis. Do you have any idea how to change this to buttons?
    Also there are only 14 buttons I would like to have 21 (including 3 encoders). I wasn't able to change this either.
    I also am a bit more familair with ArduinoIDE, do you maybe have a skecth with Buttons en Encoders?
  21. Chris_Beeves

    Chris_Beeves Member

    Joined:
    May 31, 2019
    Messages:
    103
    Balance:
    749Coins
    Ratings:
    +32 / 1 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Sounds strange with the x y axes.
    I haven’t used this code myself, I only needed buttons.
    Nope, no code other than buttons.