Giter Site home page Giter Site logo

batmobileweb's Introduction

WebBluetooth Batmobile

Controlling the LEGO Batmobile (76122) with WebBluetooth API

Code will work for general PoweredUp and Boost motors as well

What do I need?

References

Much of the bluetooth groundwork has been done by JorgePe in his BOOST reverse engineering repo Additional required bluetooth Data sniffed using nrF Connect for Mobile

Some code referenced from: https://github.com/BluetoothRocks/Batmobile Joystick from: https://github.com/yoannmoinet/nipplejs

How does this work?

The browser can connect to a Bluetooth LE device like the PowerFunctions Hub used by this particular Lego set. Each Bluetooth device has a number of services and characteristics. Think of them like objects with properties. Once connected to the device, the API then exposes these services and characteristics and you can read from and write to those characteristics.

The PowerFunctions Hub exposes a number of functions including the ability to change the direction and speed of the connected motors.

IMPORTANT NOTE: Browser (preferably Chrome) AND computer must support Bluetooth 4.0 Low Energy (LE). Buy a dongle otherwise. Also works on mobile phones with BLE support.

So how does the steering work?

The Batmobile does not have a servo motor for steering, but instead it has two motors that directly drive the two tracks. To go forward or backwards you drive the two motors in the same direction. To steer you need to drive one of the motors forwards and the other one backwards or vice-versa. This is the same way a real life tank steers.

It gets a bit tricky because the motors are rotated 180ยฐ compared to each other, so if you need to go forward, you need to drive the one clockwise and the other one counter-clockwise. That will make sure they actually turn in the same direction. And for steering both motors need to turn clock-wise or counter-clockwise depending on the direction you want to go in. This makes sure the motors actually turn in the opposite general direction. It's a bit count-intuitive.

batmobileweb's People

Watchers

 avatar  avatar  avatar

Forkers

jesuscolinv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.