Giter VIP home page Giter VIP logo

Comments (14)

jordigrau83 avatar jordigrau83 commented on August 26, 2024 3

The official Moonboard LED system "Allows up to 7 users to connect at the same time" according to their product page: MoonBoard LED System

Your readme says all features are supported in the latest app as of Nov 2023. I wanted to ask whether this specific feature of supporting multiple users is possible, however, since your readme just mentioned "show beta" and "LEDs above and below" features.

If it's not supported currently, would a feature request of this kind be considered?

Thanks for the great work put into this project!

Hi, the problem with the original version is that the BLE library is not
advertising the ble server when a device is connected, so no multiple
connections are allowed, i managed to do it adding very simple code on the
BLE library, HardwareBLESerial.cpp:

void ConnectHandler(BLEDevice central) {
// central connected event handler
Serial.print("Connected event, central: ");
Serial.println(central.address());
BLE.advertise();
}

void DisconnectHandler(BLEDevice central) {
// central disconnected event handler
Serial.print("Disconnected event, central: ");
Serial.println(central.address());
BLE.advertise();
}

void HardwareBLESerial::begin() {
BLE.setAdvertisedService(uartService);
uartService.addCharacteristic(receiveCharacteristic);
uartService.addCharacteristic(transmitCharacteristic);
receiveCharacteristic.setEventHandler(BLEWritten, HardwareBLESerial::
onBLEWritten);
BLE.addService(uartService);

// create this Handlers to advertise BLE server again:

BLE.setEventHandler(BLEConnected, ConnectHandler);
BLE.setEventHandler(BLEDisconnected, DisconnectHandler);
}

from arduinomoonboardled.

sintoris avatar sintoris commented on August 26, 2024 1

@FabianRig exactly. I spent some time trying to figure out how to do it easily with just the one Arduino. Once I realized I was out of my depth, I just bought a second Arduino to do the job.

Thanks again for the great project!

from arduinomoonboardled.

sintoris avatar sintoris commented on August 26, 2024 1

Sure, I used a pair of Schottky diodes 1A 1N5819.

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

Hi Scott,

Update: Only one user at a time is supported. When using multiple devices, you need to disconnect one and connect the other manually.

No, I have no plans on addings this feature. This project is meant for personal use, not for commercial gyms. For commercial gyms I strongly recommend the official solution.

Best regards

from arduinomoonboardled.

scott-lin avatar scott-lin commented on August 26, 2024

Got it, thanks. I was more asking for a husband and his wife scenario at home as opposed to a gym. I'll test it out if I get it all up and running on my board.

from arduinomoonboardled.

sintoris avatar sintoris commented on August 26, 2024

Hi,

I have just implemented this feature last weekend, for my mini moonboard, based on this project, for the same reason. We have not had the chance to actually use it with two smartphones yet.

To connect a second smartphone you actually need to have a second arduino nano ble. One Arduino can not be used with two names (e.g. "MoonBoard A", "MoonBoad B") at the same time.

Just connect the output of each of the two arduinos to the data wire of the led strip. Between each output pin and the data wire you need to have a schottky diode. Each Arduino can be flashed with almost the same code. Just use different names for each Arduino.

I have named one arduino "MoonBoard White" and the other "MoonBoard Purple". The app doesn't seem to care what comes after the "MoonBoard" string. The mini moonboard uses not more than 110 holds. So the remaining LEDs are lighted up either in white or purple color depending on which arduino sent the problem to the strip.

I haven't made the effort to prevent interference, e.g. if both arduino's send data to the strip at the same time. I started to, but debugging was a pain and I don't really think it will be much of a problem.

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

Hi all,

Thanks for bringing this up again!

@sintoris: If I understand you correctly, you're just using two Arduinos which share the same data line and which can talk to the LEDs at the same time. You just added diodes to stop one Arduino from talking to the other, correct? If there is no collision handling, there wouldn't be any need to adjust the code. It would be a simple hardware solution to a problem where there is no easy software solution. ;-)

I had a look at the underlying libraries. HardwareBLESerial provides a Singleton, so that would be one thing to change. We could reimplement the serial connection using the underlying ArduinoBLE library. The key problem seems to be that the library stops advertising the service as soon as there is one connection. Technically, multiple connection should be possible.

I don't have too much time on my hands and I don't see a very easy way to do it. Therefore, I don't think I'll implement it soon. It is also a trade-off between simplicity and functionality. Right now, this project is extremely simple and works perfectly for a single user (or phone). Perhaps just adding hardware (one more Arduino) is indeed the simpler solution.

Best regards

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

Great, thanks for clarifying. I think it is a valid and pragmatic solution!

Do you have a part number for the diodes? I'd add that to the README, in case somebody absolutely needs multi user capability.

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

Thanks. I've added that to the README.

from arduinomoonboardled.

jordigrau83 avatar jordigrau83 commented on August 26, 2024

from arduinomoonboardled.

sintoris avatar sintoris commented on August 26, 2024

Hi, this is great! I 'll give it a try.

One question, does this solution advertise "MoonBoard A" to all centrals?

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

That's a great solution. I'll have a look at it and will include it in the project.

It seems that there is no easy way to patch a library in Arduino. Therefore, I'll probably include the HardwareBLESerial files in this project and change the files locally. If you know a better way, please let me know.

I've created another issue to track the changes there: #21

from arduinomoonboardled.

jordigrau83 avatar jordigrau83 commented on August 26, 2024

from arduinomoonboardled.

FabianRig avatar FabianRig commented on August 26, 2024

The "new" firmware seems to work fine. Advertisement continues as planned. Could you please check and report here: #21 whether it works as expected?

from arduinomoonboardled.

Related Issues (20)

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.