-
Posts
1,234 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Everything posted by Lok24
-
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
No, not at all. You just have to load a program into your hub. That's all. But you also can use Smart Devices, then programs can be shared via LEGO Life. And such control centers could be used (and are used) due to the open architecture with the existing PU/Spike-Hubs. It's just a question where the operative code is placed. -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
There ist only one "medium", the 88008 "Medium Linear Motor", and it has an encoder and was sold with the Boost Set. Perhaps you meant the old 45303, looking like the PF-M? This isn't sold any more (since last year)? (and had no encoder) -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Ok. Just had a look on lego page, it says medium Motor 27,99 $, train motor 22,99 $ The L-Motor is available too, 29,99 $ -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Yes I understand that, but I asked: why? What is the idea selling motors without? -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
to me it's a difference if a "system" doesnt support some function or if the products just are too big, too weak or even missing. In other words, it's not "PU" but the missing products with PU/Spike. Of cause other remotes with other properties are possible - but not yet developed. -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
That's the point: you need an external/additional device to control. And: you have no load control. You've seen the video with a train creeping over a switch point? Always with same speed, independent from battery charge? I think this is not possible with PF. The 88008 is 6 studs, the "Small angular" even 5 studs, as far as I know.The PF Servo is 7 studs. Please correct me if I'm wrong. I agree that there should be small(er) motors, but I think this does not interfere with the encoder. And ist has nothing to do with the properties of the "PU system" Yes, " could", but why? What would be the benefit? That's the question ..... -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Hello @ all, here's a collection of questions (and answers) I could ask the PU devolpers 4 years ago (LEGO Fanweekend Skaerbaek Sep. 2019), there are some points discussed and announced, like multiplexing, speaker, VM and so on https://www.1000steine.de/de/gemeinschaft/forum/?entry=1&id=426445#id426445 (german , please use a translator app of your chioce) And here's a statement concerning VM (LEGO Fan Media day 2021) https://ramblingbrick.com/2021/05/28/the-road-map-for-legos-powered-up-system-unfolds/ Quote: "This feature has provided a few challenges to implement, but is getting closer to rolling out as part of a closed Alpha version soon." -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
But if you have a dumb motor and you build something new or do some experiments you then have to buy a new motor. And look at something simple like a windmill: with a dump motor you have to build a gearing mechanism to adjust speed. This is not needed with a motor with encoder. It makes even simple thing much simpler. None of my PU or EV3 MOCS, has any gears. What would be better with motors without encoder? There is just one , the train motor. Its the way lego want's to go load programs permanently into hubs. It's annouced since years. -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
1.) The price is just 3 € higher than for a dump train motor ;-) 2.) the encoder enables the motor to be used as sensor or servo in other szenarios, and it offers load regulation. 3.) we still wait for extension calbes 4.) we still wait for the VM solution -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
The python programs for alle technic sets are already there, no need for any programming. And If you have a remote (of any kind) and hubs you always have to configure that in any kind. Why not use a Smart device ? Where a the children who would find that "unsual" How should that be configured in your " Control center+ " environment? I use her a standard remote and City Hub with an ESP32 (app. 10€) as a "Batterybox", where you can configure speed, direction, time to run and many more via web-Browser. -
Lets "fix" powered up!
Lok24 replied to allanp's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
It is here: https://lego.github.io/lego-ble-wireless-protocol-docs/ and, to be precise, "control+" is only the app. This protocol ist used to devolop thnings like Pybricks or legoino. You can make your technic sets sustainable if you load the existing code via pybricks into the hub(s). No programming needed, taks app. 5 min. Regarding motors: there is only one(!) without sensors, the train motor, and the price difference is just 3€ And you can use the SPIKE Prime Sensors as well. -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
I understand. But as far as I know: If you use two hubs and two remotes and connect each hub with one remote, they migtht all for devices show green? Without interferring with each other. Except when the remote stores the "channel". -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
But why read it? Just set it. You have a "connect" somewhere in your prog: my_remote = Remote() And after that succesfully established you set: remote.light.on(Color.RED) hub.light.on(Color.RED) -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Perhaps it is possible to start the program automatically when turning on the hub, I don't know. But "normally" it is like you described. And the remote doesn't eally actively pair, the programm waits for a remote to connect. And the remote doesn't "choose" a color. Just set it as desired. -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
This is completely different with Pybricks You have to start the Hub and then connect a remote within 10 seconds (or try it more often) . The colors can bet as you like. Of course with the LEGO process, if you have different remotes and hubs they all can be "blue", not showing which are connected with each other. -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Hi, correct, all motors use the Pybricks routines, "run" or "dc", depending on the device ID (which depends on the cable in DC-Motor cases here is an extract : Portcheck: # detect motor id if "Motor" in devices[id] and not("DC" in devices[id]): motor[i].setType("Motor") # and set type for simple DC Motors if "DC" in devices[id]: motor[i].setType("DCMotor") drive: # send the real commands to the devices if motor[x].getType() == "Motor" : motor[x].obj.run(s*motor[x].getSpeed()) # in 2.7 if motor[x].getType() == "DCMotor" : motor[x].obj.dc(s) -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
You should then add them to the device list in "def portcheck(i)" and then apply to the "drive()" routine. As a first idea..... -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
I never had any layout, just built some locos. The idea to that program came up with the crocodile ...... It should be useful for those, who used any motor(s) with the city hub. (not for me ;-) ) And as, mentioned, "Battery box" uses the same base. Yes, but it was mentioned here: Anyway if there are a few "Python experts" we could discuss how to devolop that for further applications. -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
No, I don't, but I don't use it any more (I have no application for such a program at all, as for the two others of the "family") I not very familiar with Python, that's why the program is a little bit -hm- tricky? The intention I explained already. And I'm really trying to support, the issue mentioned her was fixed in 2.9 and I reported that in April here at Eurobricks. Spooky! I'm sure that I never had set this value (cause I only have on remote). -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Thanks, as assumed, the motor(port) command, which was not supported any more. The block looks like that: devs_max_speed = {38:1530,46:1890,47:1980,48:1367,49:1278,75:1367,76:1278 } dspeed = devs_max_speed.get(PUPDevice(port).info()['id'], 1000) motor[i].obj.stop() motor[i].obj.control.limits(speed=dspeed,acceleration=10000) motor[i].setSpeed(dspeed/100*0.9) Seems that you use 2.7 which is not the latest Version.... Have a look: # ----------------------------------------------- # MotorControl # # uses https://code.pybricks.com/ , LEGO City hub, LEGO remote control # connect 1 or 2 motors of any kind to Port A and/or B # # Version 2_9 # -----------------------------------------------/ from pybricks.parameters import * # Color # ----------------------------------------------- # Set user defined values # ----------------------------------------------- # define the two profiles # profil_x = (minimun speed,maximum Speed,accelerate in steps of ..., wait for next acceleration(in ms) Profil_A = (20,100,10,100) #min,max,step,acc Profil_B = (10,500,5,200) #min,max,step,acc # define direction of motors dirMotorA = 1 # Direction 1 or -1 dirMotorB = -1 # Direction 1 or -1 autoacc = False # accelarate continously when holding butten # ----------------------------------------------- # Set general values # ----------------------------------------------- # assign buttons to function1 # syntax: function = "name" # name may be "A+","A-","A0","B+","B-","B0","CENTER" UP = "A+" DOWN = "A-" STOP = "A0" SWITCH = "CENTER" mode=1 # start with function number... watchdog = False # "True" or "False": Stop motors when loosing remote connection remoteTimeout =10 # hub waits x seconds for remote connect after starting hub remoteName = "" # connect this remote only # Color and brightness of Hub LEDs LEDconn = Color.GREEN*0.3 # if Hub connected, color * brightness LEDnotconn = Color.RED*0.5 # if Hub is not connect, color * brightness LED_A = Color.GREEN*0.3 # Remote Profil_A, color * brightness LED_B = Color.RED*0.5 # Remote Profil_B, color * brightness # ----------------------------------------------- # Import classes and functions # ----------------------------------------------- from pybricks.pupdevices import DCMotor, Motor, Remote from pybricks.parameters import Port, Stop, Button, Color from pybricks.hubs import CityHub from pybricks.tools import wait, StopWatch from pybricks.iodevices import PUPDevice from uerrno import ENODEV # ----------------------------------------------- # function 1 / drive motors # ----------------------------------------------- def function1(): vmax = profile[mode].vmax vmin = profile[mode].vmin accdelay = profile[mode].acc step = profile[mode].step global v if CheckButton(UP) and not CheckButton(STOP) : for x in range (1, step + 1): v = v + 1 if v > vmax : v = vmax if v > 0 and v < vmin: v = vmin if abs(v) < vmin: v = 0 drive() wait (accdelay) if v==0: break # further acceleration if button keeps pressed while autoacc == False and CheckButton(UP) : wait (100) # avoid changing direction when reaching "0" while v == 0 and CheckButton(UP): wait (100) if CheckButton(DOWN) and not CheckButton(STOP): for x in range (1, step + 1): v = v-1 if v < vmax*-1 : v = vmax*-1 if v < 0 and v > vmin*-1: v = vmin*-1 if abs(v) < vmin : v = 0 drive() wait (accdelay) if v==0: break # further acceleration if button keeps pressed while autoacc == False and CheckButton(DOWN) : wait (100) # avoid changing direction when reaching "0" while v == 0 and CheckButton(DOWN) : wait (100) if CheckButton(STOP): v = 0 drive() wait (100) class setprofile(): def __init__(self,pr): self.vmin=pr[0] self.vmax=pr[1] self.step=pr[2] self.acc=pr[3] profile = [0,0,0] profile[1] = setprofile(Profil_A) profile[2] = setprofile(Profil_B) # ----------------------------------------------- # function 2 # ----------------------------------------------- ''' def function2(): if CheckButton(UP): timer[1].set(3000) if timer[1].check(): print("Do something") ''' # ----------------------------------------------- # general program routines and classes # ----------------------------------------------- # ----CheckButton ------------------------------------------- def CheckButton(x): try: button = remote.buttons.pressed() if x == "A+" : x = Button.LEFT_PLUS if x == "A-" : x = Button.LEFT_MINUS if x == "A0" : x = Button.LEFT if x == "B+" : x = Button.RIGHT_PLUS if x == "B-" : x = Button.RIGHT_MINUS if x == "B0" : x = Button.RIGHT if x == "CENTER" : x = Button.CENTER if x in button: return True else: return False except: return() # ----delay ------------------------------------------- class delay: def __init__(self,id,time=0,watch=StopWatch(),busy=False): self.id=id self.time=time self.watch=watch self.busy=busy print ("Init Timer",id) # set a timer def set(self,x): if self.busy == False: self.busy = True self.watch.reset() self.time = x print("Timer",timer[1].id, "set to",x) #check if timer is reached, then return "True" def check(self): if self.busy == True: if self.watch.time() > self.time: self.busy = False self.time=0 print("Timer",timer[1].id, "stopped") return(True) else: return(False) # ----drive ------------------------------------------- def drive(): global vold global v print (v) if vold != v: # for each motor 1,2 for x in range(1,3): # set speed and direction s = v*round(motor[x].getDir()) # real motor commands depending on motor type if motor[x].getType() == "Motor" : motor[x].obj.run(s*motor[x].getSpeed()) # in 2.7 if motor[x].getType() == "DCMotor" : motor[x].obj.dc(s) if v == 0 and motor[x].getType() != "---": print("stop",x) motor[x].obj.stop() #if motor[x].getDir() != 0 and motor[x].getType() == "DCMotor" : motor[x].obj.dc(s) vold = v # ----portcheck ------------------------------------------- def portcheck(i): # list of motors, 1 +2 contain string "DC" devices = { 1: "Wedo 2.0 DC Motor", 2: "Train DC Motor", 38: "BOOST Interactive Motor", 46: "Technic Large Motor", 47: "Technic Extra Large Motor", 48: "SPIKE Medium Angular Motor", 49: "SPIKE Large Angular Motor", 75: "Technic Medium Angular Motor", 76: "Technic Large Angular Motor", } port = motor[i].getPort() # Try to get the device, if it is attached. try: device = PUPDevice(port) except OSError as ex: if ex.args[0] == ENODEV: # No device found on this port. motor[i].setType("---") print(port, ": not connected") return ("---") else: raise # Get the device id id = device.info()['id'] # Look up the name. try: # get the attributes for tacho motors if "Motor" in devices[id] and not("DC" in devices[id]): motor[i].setType("Motor") motor[i].obj = Motor(port) #new in 2.7 # if motor[x].getDir() != 0 and motor[x].getType() == "Motor" : motor[x].obj.run(s*motor[x].getSpeed()) # in 2.7 devs_max_speed = {38:1530,46:1890,47:1980,48:1367,49:1278,75:1367,76:1278 } dspeed = devs_max_speed.get(PUPDevice(port).info()['id'], 1000) motor[i].obj.stop() motor[i].obj.control.limits(speed=dspeed,acceleration=10000) motor[i].setSpeed(dspeed/100*0.9) # and set type for simple DC Motors if "DC" in devices[id]: motor[i].setType("DCMotor") motor[i].obj = DCMotor(port) except KeyError: motor[i].stype("unkown") print(port, ":", "Unknown device with ID", id) wait(100) print ("--") print(port, ":", devices[id], motor[i].getType(),motor[i].getSpeed(),motor[i].getAcc()) # ---- device ------------------------------------------- class device(): # store the device infos for each motor def __init__(self,port,dir): self.port = port self.dir = dir self.type="" self.speed=99 self.acc=99 self.obj="" def setType(self,x) : self.type = x def setSpeed(self,x): self.speed = x def setAcc(self,x) : self.acc = x def getType(self) : return self.type def getPort(self) : return self.port def getDir(self) : return self.dir def getSpeed(self) : return self.speed def getAcc(self) : return self.acc # ----------------------------------------------- # globals # ----------------------------------------------- v = 0 vold = 0 #remoteConnected = False # ----------------------------------------------- # Ininitialize # ----------------------------------------------- hub = CityHub() #define timers timer = [0,0,0] timer[1] = delay(1) timer[2] = delay(2) #define motors motor = [0,0,0] motor[1] = device(Port.A,dirMotorA) motor[2] = device(Port.B,dirMotorB) # get the port properties portcheck(1) portcheck(2) # ----------------------------------------------- # remote connect # ----------------------------------------------- hub.light.on(Color.RED) print (hub.system.name()) try: remote = Remote(name=remoteName,timeout=remoteTimeout*1000) except OSError as ex: hub.system.shutdown() # ----------------------------------------------- # main loop # ----------------------------------------------- while True: # --check if remote is connected --------------------------------- try: button = remote.buttons.pressed() hub.light.on(LEDconn) remoteConnected = True except OSError as ex: hub.light.on(LEDnotconn) print("Remote not connected") remoteConnected = False if watchdog == True: v=0 drive() try: # reconnect remote remote = Remote(timeout=1000) wait(100) print("Remote reconnected") remoteConnected = True except OSError as ex: print("Remote not connected") if CheckButton(SWITCH): mode = mode+1 if mode > 2: mode = 1 print (mode) if mode == 1 : remote.light.on(LED_A) if mode == 2 : remote.light.on(LED_B) while CheckButton(SWITCH): button = remote.buttons.pressed() wait (100) if mode == 1 : function1() if mode == 2 : function1() wait(10) -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Sorry, perhaps a missunderstanding,I removed it (as far as I remember) when it did'nt work any more, and I had no time to look for the problems. Yes, that's why I published it there, an there was no feedback at all about bugs, suggestions or something. And again I have no idea why it did not work again now ;-) Assume something like motor(port). ..... Latest Version was MotorControl2_9.py from January 2023. -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Yes, I removed it some time ago, cause it didn't work any more and there was no feedback. -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Hi First of all: thanks for all your interest. The program was first realeased at Github, with the intention to improve it and keep it "alive", but found no interest at all. Then it was distributed in some german communities, but always in it's original form. The idea of the program and it's unusual structure was: - sepearting functions into dedicated routines (as in libs) - make behaviour adjustable by user via paramters - place them all at the beginning of the code - present them in a way, that no "python-programming" is needed to change them. So new programs with other functions (like my battery box or pendular train) could be easily written by only defining "function1" and the paramtes, all other is always the same, including the main loop ;-) If someone likes to discuss this here and improof the code (more classes instad of function, handling of remote etc), i'd like to offer same ideas ;-) Find here the Original description: Parameter und ihre Funktion: Profile Das Programm hat zwei Geschwindigkeitsprofile, mit denen in erste Linie der Grad der Beschleunigung eingestellt wird Profil_A = (5,75,10,100) #min,max,step,acc Profil_B = (5,75,5,200) #min,max,step,acc Die Motoren starten bei „min“ und laufen nicht schnell als „max“, hier also zwischen 5 und 75. Weniger als 5 ist nicht sinnvoll, 100 ist der maximale Wert. Der dritte Wert „step“ besagt um wie viele Stufen sich die Geschwindigkeit ändern soll, wenn man die Taste kurz drückt. Im ersten Fall also um 10 von 5 auf 15, 25 usw., im zweiten um 5 von 5 auf 10,15,20 usw. Der vierte Wert „acc“ gibt die Zeit an, die zwischen den Werten liegt, im ersten Fall 100 Millisekunden, im zweiten 200 ms. Das Profil B beschleunigt also in kleineren Schritten, die länger auseinanderliegen, das beschleunigt insgesamt langsamer. Drehrichtung Die Drehrichtung kann für die Motoren an A und B getrennt eingestellt werden, Werte sind 1 und -1 dirMotorA = 1 # Direction 1 or -1 dirMotorB = -1 # Direction 1 or -1 Automatische Beschleunigung autoacc = True beschleunigt automatisch weiter, wenn man die Taste gedrückt hält, bis zum Maximalwert. Mit „False“ wird immer nur bei einem erneuten Tastendruck die nächste Stufe erreicht Knöpfe Das Programm hat vier Funktionen, die hier den Knöpfen der Fernbedienung zugeordnet werden. „UP” -> Schneller „DOWN” -> Langsamer „“STOP” -> Stop „SWITCH” -> Umschalten zwischen Profil A und B Und die Fernbedienung hat sieben Knöpfe: A+","A-","A0","B+","B-","B0","CENTER" (der grüne) Das kann man dann so zuordnen: UP = "A+" DOWN = "A-" STOP = "A0" SWITCH = "CENTER" Oder auch UP = "B+" DOWN = "B-" STOP = "A0" SWITCH = "A-" Oder beliebig anders LED der Fernbedienung Einstellen der Farbe und Helligkeit der LED, jeweils bei Profil A oder B Dazu jeweils die FARBE ändern, dann kommt der Stern, und dann die Helligkeit zwischen 0 und 1 LED_A = Color.GREEN*0.05 # Remote Profil_A, color * brightness LED_B = Color.RED*0.05 # Remote Profil_B, color * brightness Das „= Color.“ muss so stehen bleiben. Gültige Farben (Großschreibung beachten!) RED ORANGE YELLOW GREEN CYAN BLUE VIOLET MAGENTA Watchdog Bei „True“ stoppen die Motoren, wenn die Fernbedienung den Kontakt verliert, bei „False“ laufen sie weiter, bis die Fernbedienung erneut Kontakt hat (erneut Knopf an der Fernbedienung drücken). watchdog = False # "True" or "False": Stop motors when loosing remote connection Timeout Gibt an, wie viele Sekunden nach dem Starten des Programmes auf eine Verbindung zur Fernbedienung gewartet wird, wird die Zeit überschritten geht das Hub aus. remoteTimeout =5 # hub waits x seconds for remote connect after starting hub Nur eine bestimmte Fernbedienung verbinden Wenn ein Wert angeben wird, kann sich nur eine Fernbedienung mit diesem Namen verbinden (der Name kann z.B. über die Powered Up App geändert werden) remoteName = "" # connect this remote only, "" connects any remote LED des Hub LEDconn gilt, wenn die Fernbedienung verbunden ist, LEDnotconn, wenn sie nicht verbunden ist, z.B. auch beim Starten des Programms. LEDconn = Color.GREEN*0.3 # if Hub connected, color * brightness LEDnotconn = Color.RED*0.5 # if Hub is not connect, color * brightness