Cosmik42

Control all your Powered Up & Power Function (SBrick) devices with a single software

Recommended Posts

This is amazing @Cosmik42 - fantastic work and very generous of you to openly share it with the community here.

 

I have been looking for a train automation solution using Lego original parts wherever possible and this looks potentially ideal for that.

 

Two questions for you:

1-Any plans to release a Mac O/S version at any point?

2-If/When Powered Up to Power Functions cable converters become available (either from TLG or a 3rd party), do you think your app could be used to control PF parts connected to a Powered Up/Boost hub? (even if only in a limited on/off way)

Share this post


Link to post
Share on other sites
Posted (edited)
4 hours ago, Giottist said:

If the sensor is connected to port D nothing happens.

This is fixed and already uploaded again on V0.3! I also believe your connection spam should be gone. Please confirm!

Also, find below a video that gives a great example using a detector, a switch and 2 trains (@Lok24, this one is public normally)

https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F2428195644074254%2Fvideos%2F570905956688893%2F&show_text=0&width=560

 

Thanks for the kind words @ElectroDiva!

2 minutes ago, ElectroDiva said:

1-Any plans to release a Mac O/S version at any point?

Unfortunately no :( I do not know this OS well enough to program on it :(

Quote

2-If/When Powered Up to Power Functions cable converters become available (either from TLG or a 3rd party), do you think your app could be used to control PF parts connected?

As long as the motor/sensor is plugged to a Powered Up Hub, we can control it.

Edited by Cosmik42

Share this post


Link to post
Share on other sites
Posted (edited)
28 minutes ago, Cosmik42 said:

@Lok24This is fixed and already uploaded again on V0.3! I also believe your connection spam should be gone. Please confirm!

Hey Cosmik42, please have a break and a coffee and enjoy your sunday afternoon :classic:

At the moment I have to wait until my long run test of a solution for rechargable Li-Ion batteries for the train hub will come to an end (It runs since 3.75 hours and the voltage display shows still 64%...)

And wow: i discovered you're using the WeDo 2.0 distance sensor which is available yet in contrast to the color/distance sensor which can be obtained only by a complete BOOST set or for an incredible charge on ebay or bricklink. That can be very useful for signals ...

Minutes later: Ah, the battery is empty. It took 3h 47' to drain it by a idling train motor and the lights. I will publish the results in an extra thread ...

A quarter hour later and I can confirm: Yes now everything works as planned. Wow, what a program!

Edited by Giottist

Share this post


Link to post
Share on other sites
42 minutes ago, Cosmik42 said:

As long as the motor/sensor is plugged to a Powered Up Hub, we can control it.

 

Great news - thanks!

I’ve got stacks of 9v parts - just need a cable solution now..

Share this post


Link to post
Share on other sites
Posted (edited)

I've noticed your software uses WinForms. You should consider to migrate your code to XAML/WPF as soon as possible. It would be lots of work once you've created many dialogs. For a modern, appealing UI, you'll definitely need XAML. I know that the first steps with XAML can be frustrating, but spending a few hours learning XAML will save you lots of time working around the limitations of WinForms later on.

Edited by legotownlinz

Share this post


Link to post
Share on other sites
1 hour ago, legotownlinz said:

I've noticed your software uses WinForms. You should consider to migrate your code to XAML/WPF as soon as possible. It would be lots of work once you've created many dialogs. For a modern, appealing UI, you'll definitely need XAML. I know that the first steps with XAML can be frustrating, but spending a few hours learning XAML will save you lots of time working around the limitations of WinForms later on.

It's a fair point. I used to be a full time programmer, 'back in the days'. Having only few spare time to work on this, I took the short path which is to work with what I already know. What are the real advantage of xaml beside a more modern UI?

Share this post


Link to post
Share on other sites
Posted (edited)
46 minutes ago, mattmarsden said:

Would you be able to get this to control sbricks and buwizz? That would be really fantastic!

I don't own any of these unfortunately. I can look at ordering a couple of those.

Edited by Cosmik42

Share this post


Link to post
Share on other sites
Posted (edited)

Buwizz is way too pricy for me unfortunately. 100+ EUR for one motor.

However, the sBrick protocol is great!
It's all BLE so it fits the philosophy of this software. Ordering some right away.

Edited by Cosmik42

Share this post


Link to post
Share on other sites
1 hour ago, mattmarsden said:

Would you be able to get this to control sbricks and buwizz? That would be really fantastic!

Hmm, Cosmik42s software makes it possible to use standard LEGO hardware with similar functionality. For one SBrick I can get three train hubs (at the moment at BrickLink).

Share this post


Link to post
Share on other sites
38 minutes ago, Cosmik42 said:

Buwizz is way too pricy for me unfortunately. 100+ EUR for one motor.

However, the sBrick protocol is great!
It's all BLE so it fits the philsophy of this software. Ordering some right away.

Excellent news!

Share this post


Link to post
Share on other sites
26 minutes ago, Giottist said:

Hmm, Cosmik42s software makes it possible to use standard LEGO hardware with similar functionality. For one SBrick I can get three train hubs (at the moment at BrickLink).

I think it's more for people who have already invested in this.
Just ordered one SBrick Hub - it's no cheap indeed! :D

Share this post


Link to post
Share on other sites

Another info update: I warned in another thread not to use the original LEGO app if you're using android 5.0.2 or older since the original app is not only bloated but also contains a lot of bugs. With Cosmik42s train software there is no need for this app anymore.

With one exception: To update the firmware on the train hubs. Fortunately this works still with my old smartphone with android 5.0.2. Three of my four hubs were updated (to what version ?), the fourth has a recent firmware version. Immediatly I threw the LEGO bloatware out of my smartphone after the firmware were updated.

Some train hubs are recognized now as "Hub No 4.", the others as "Smart Hub" but function is not affected. The BOOST hub is recognized allways as "Move Hub". All hubs cooperates with the software without any flaw.

Share this post


Link to post
Share on other sites

Happy to read!

On my side I have bumped into a limitation. My current bluetooth dongle cannot take more than 5 BLE connected at once. After some research I have found a dongle which people say can host up to 14 BLE simultaneously. I receive it tomorrow so I will keep you updated!

Share this post


Link to post
Share on other sites

@Cosmik42 - Good to see you’re open to supporting additional 3rd party receivers.

 

Have you heard of and would you possibly consider supporting the PFx brick with your app?

 

It’s a power functions compatible Bluetooth + IR receiver similar to SBrick but crucially allows lighting and sound effects to be supported through the receiver. 

 

Here’s a couple of videos of it in action:

 

This + your automation software would in my opinion be close to the perfect solution for automating a layout (perhaps with the cheaper PU hubs used for simpler applications like track switching)

Share this post


Link to post
Share on other sites

I have another problem. With the V0.3 I no longer control my trains. No hubs are shown.
Refresh Ui does nothing for me.

What do I do wrong?
 

lego train.PNG

Share this post


Link to post
Share on other sites

Dear All,

I think we should maybe calm down a little.

What @Cosmik42 is achieving here is simply incredible. Whereas the PuP tear down thread laid the foundation, the official release of the LEGO protocol ("official" as in "considerable preliminary" - that document is indeed far from anything TLG has released in the past. I am asking myself what has happend there … just cranking out stuff, as it appears. To me that is very disturbing - but oh my - that is only me) took us further, all the other spread-over-the-net findings even push things … as far as I am aware, Cosmik's software is the one and only that works almost flawlessly.

OK there are bugs here and there, limitations not considered (e.g. with a particular BLE hardware not more than 5 hubs etc …), but this software is simply - stunning. Question is why "users" or better customers have to do that - but OK, maybe it is envisioned from the TLG perspective as a parallel to the "building experience". Thing is that folks who have no idea how to get the BLE protocol working are simply not in the building experience world.

Which is OK: They gave us the remote control. Heck, with PF that was it! Get it going with the PF remote or find out yourself. I had to use a NXT brick equipped with a HiTechnic IRLink sensor plus RF hardware to get remote PF/RC train control from my computer working.

With BLE things change considerably. All of a sudden wireless remote control is essentially built into a modern computer or smart device (I don't have any - SMS still works with my Nokia C3). It is so close. And very tempting. On the other hand it is not "simple". And a lot of very carefully performed work is required to get it going.

I suggest that when we want support for "this and that" we should provide Cosmik with "this and that" hardware. I did that in the past as well. Was asking for RobotC support for RCX1.0 bricks. Well, sent one of these bricks to the RobotC developers - and boom got it.

Even then though, we should remain calm. This is all very exciting. But this needs some time to develop AND BOLD TESTING. The latter part is often overseen: on one machine it (somehow) works (as if it was straight forward and as expected). Send out the good news. And then it all begins: There are myriads of machines out there - may run on Win7/8/8.1/10 (as Cosmik was telling us - he is a "former" windows programmer) - hey and XP (yes!), Vista, and what not. And: There is even more BL/BLE hardware. It appears as if there are more BLE sticks than you can count. Hope is all vendors paid very very close attention to the official BL/BLE rules and recommendations. 

All I am saying is: I believe it would be good to focus on TLG BLE stuff first and make that work as reliably as possible. And then expand into 3rd party hardware …

Just my 2 cents ...

All the best
Thorsten

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, TheLarry98 said:

I have another problem. With the V0.3 I no longer control my trains. No hubs are shown.

@TheLarry98, insteresting. I just made a debug version for you:
https://www.dropbox.com/sh/l2t7pu6ltctp4l7/AAAKs69DVwtLGHCHDZdNaQG6a?dl=1

Can you download it, run it and let me know if the hub shows up?
Also, if it does not, can you please click 'Add Program' and then 'Start Program'. Let me know the output then!

7 hours ago, Toastie said:

I believe it would be good to focus on TLG BLE stuff first and make that work as reliably as possible. And then expand into 3rd party hardware …

@Toastie - I agree and this is my plan for now. 
@ElectroDiva - Unfortunately I do not own this hardware yet, and it starts to be a lot of protocols to follow up on. I still want to make the fundation robust for PuP for now and explore 3rd party protocoles once the automation is clean. Though thanks for pointing out at this other protocol!

Edited by Cosmik42

Share this post


Link to post
Share on other sites
1 minute ago, Cosmik42 said:

 

@ElectroDiva - Unfortunately I do not own this hardware yet, and it starts to be a lot of protocols to follow up on. I still want to make the fundation robust for PuP for now and explore 3rd party protocoles once the automation is clean. Though thanks for pointing out at this other protocol!

No worries Cosmik - completely understand and agree that you should focus on getting the PuP support as good as possible. What you’re doing is amazing - keep up the good work!

Share this post


Link to post
Share on other sites
6 hours ago, ElectroDiva said:

No worries Cosmik - completely understand and agree that you should focus on getting the PuP support as good as possible. What you’re doing is amazing - keep up the good work!

Thank you! Don't worry, if people do use this software, I have plenty of spare time to push as far as needed.

Share this post


Link to post
Share on other sites

I’m sure there will be plenty of people using the software @Cosmik42 - the community here for a start :)

 

Whenever you do get some time to broaden it out - PM me and I’ll send you one of my PFx bricks, a mini speaker and a lighting kit to experiment with.

 

Also paging @touthomme (one of the inventors of the PFx brick who may be interested in following this thread)

Share this post


Link to post
Share on other sites
Posted (edited)

@ElectroDiva, really appreciate your offer to lend some hardware to experiment when time will be right.

@touthomme, do you have an open API maybe?

Edited by Cosmik42

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Cosmik42,

my first PoweredUp components arrived and work fine.

Just downloaded your program: awesome! Thanks al lot!

But I'm a little bit confused, I'v got a file that saysV.03, but "About" V0.1. Now I found the "Debug V2" which seems to be more actual,  but still "about V0.1" Did I mix something up? Which one should I use? The Debug V2 offers "refresh UI" and "configure" the ports (name for Motor etc.)

Second: for the C# snippets

Is there a list/and or summery for commads, parameters and usage?

Edit: Ah, just found, in the new version tey are listed in the title. But the rampMotorSpeed is defined  as (port, speed, time), but leads to an error (# of parameters)

There are noc commands for Hub[0] ?

Any help welcome!

 

 

 

 

Edited by Lok24

Share this post


Link to post
Share on other sites
1 hour ago, Lok24 said:

I'v got a file that saysV.03, but "About" V0.1.

Oh good catch! It was hard-coded, now it is properly dynamic and will show the correct version (V0.3.1)

1 hour ago, Lok24 said:

Is there a list/and or summery for commads, parameters and usage?

I was working on it today!
I just added 'Autocomplete'! As soon as you type '.' it will show a dropdown list of valid function like this:

49938039_2438388409721644_48970033287156

1 hour ago, Lok24 said:

the rampMotorSpeed is defined  as (port, speed, time), but leads to an error (# of parameters)

Oops! It is fixed in this updated version!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.