Jump to content

Recommended Posts

Posted
  On 12/27/2020 at 7:48 PM, Smotek7 said:

Hello,
I need advice.
I want to create a train switch driver for my son.
I want to control it using the Powered UP app.
That's why I was looking for a way to emulate HUB.
I want to use an RC servo for switching.
@toastie Up in the post you write that you have an emulator in nodeMcu ESP32.
I have this board. Can you please advise me how to edit the code so that I can upload the code to NodeMcu?
I have Arduino IDE installed and ESP32 boards installed.
My first step is to test NodeMcu communication with the Powered UP app.
Thank you for any advice.
Rasto

Expand  

Would Legoino work for that?  https://github.com/corneliusmunz/legoino

 

Posted
  On 12/28/2020 at 10:59 PM, dr_spock said:

Would Legoino work for that?

Expand  

That is what I don't know. I am using Legoino to program the ESP32 as client and access hubs as servers. On "my" ESP32 side, there are buttons (start/stop/etc) and a display (very tiny OLED) to let me know what is going on.

As far as I understand, @Smotek7 wants to use the PU App as client to access the ESP32 as server (which then throws switches etc)? This may be incorrect though.

Best
Thorsten

Posted

Hi,

I'm very confused now.

  On 12/28/2020 at 11:06 PM, Toastie said:

I am using Legoino to program the ESP32 as client and access hubs as servers. On "my" ESP32 side, there are buttons (start/stop/etc) and a display (very tiny OLED) to let me know what is going on.

 

Expand  

But then the ESP is the server, it makes the conncetions to the Hubs (clients) and sends commands to them, i.e. running a motor.

What @Smotek7 want's to do is other way round, the PoweredUp App is the server, it connects the ESP (as a client) and sends commands.

And that is just what is described in this thread, using the ESP like a Hub to execute commands from the App.

No?

And yes, legoino does, as far as I understood..

Posted

Hi @Lok24,
i need HUB emulation.
Today I managed to test legoino as a HUB emulation.
It's what I need, it's just for City HUB as I understand it.
I managed to control 1 piece of RC servo with LEGO app.
PORT A doesn't work, I wrote on github.

When I have something new, I will write.

Rasto

Posted
  On 12/29/2020 at 12:20 PM, Smotek7 said:

Hi @Lok24,
i need HUB emulation.
It's what I need

 

Expand  

That's what I expected. Yes, it'not like a Move Hub, but City and technic should only differ in available ports.

But let's wait for Cornelius to explain on github.

Posted (edited)
  On 12/29/2020 at 11:59 AM, Lok24 said:

But then the ESP is the server, it makes the conncetions to the Hubs (clients) and sends commands to them, i.e. running a motor.

Expand  

Well, I understood the BLE client server model this way: the hub is a server which, well, serves:pir_laugh2: its clients by providing services: This is from the LWP doc:

"The LEGO Bluetooth 3.X Hub Profile consists of a single Bluetooth LE GATT service. The service allows users to read info about the LEGO Hub (name, battery level, etc.) and to interact with any sensors and motors connected to it."

So clients need to discover what services are available and then sign up for or use these. As my ESP32 is doing exactly that (it asks the hub what type of motor is present and signs up for RSSI and bat level updates and then issues the appropriate motor commands - to be served ...).

Since messing around with CPM and UNIX/V systems I was always a little fuzzy about who is who regarding client/server models.

Oh well, this is not the topic here and you guys already found your way I guess.

Best
Thorsten 

PS.: Just saw the video @Smotek7 made: Very nice work indeed!!! So in this case the ESP32 is the server and the App is the client, I believe ... :pir-huzzah2:

Edited by Toastie
We call it master and servant ...
Posted (edited)

Sounds good as well....perhabs you're right :wink:

Master (central)  and slave(peripheral) is obviously what I described.

As from what I read now, the Hub seems to be client and server at the same time......

Edited by Lok24
  • 7 months later...
Posted
  On 12/30/2020 at 10:42 PM, Smotek7 said:

Today I created a prototype HW for
LEGO servo HUB.
4 output ports for RC servo.
Just wait for the SW modification.
 

HUB2a.jpg

HUB1a.jpg

Expand  

@Smotek7

Very nice. Can you share the code to control RC servos using ESP32?

Is it possible to create multiple "fake hubs" using just one ESP32 to control more than 4 servos?

Posted (edited)

This is probably my latest version.
It's just a modified example, I don't have a description there.
I think only 4 outings can be made.
It's a limited Lego app.
Only add more pieces of ESP2, it can be distinguished in the app.
 

Edited by Smotek7

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...