Not long ago, i created a program in Powered Up that can control a basic car like the Top Gear rally car or the 4×4 X Treme Off Roader. The code was quite complicated and the main reason is the implementation of the calibration for the Powered Up motor and the fine tuning of the steering. I received many questions since then. You asked if it can be made in a more simple way. I would like to show you now in details what the challenge is with the Powered Op server mode, why it is different from the Power Functions servo, and what will you lose if you make it more simple and try to do a very simple setup with the Powered Up remote, so let’s get back a little bit to the power functions servo. Første, we used this one since 2012, when it was introduced in the set 9’8. This servo has several positions in each direction besides the zero one, so it’s not very precise, but i think for lego vehicles. It is perfectly fine. With the power functions infrared system, there are two ways to control the servo one is using the smaller remote similar to the one that came with the original 9’8 set. This remote only offers bang bang control. That means there are only three positions for each of the levers: zero and the two different directions for speed control. That means full forward for backward and stop for steering. We only have full left right and center.
The servo has a return to center function. That means it will automatically go back to the center position if you release the lever of the remote. This is quite important when you want to control a car. You don’t need to find the center position yourself. The servo will do it automatically. Som du kan se, the central position is marked on the servo, so you don’t need to guess it. The other option for control is the power function? Train remote? This one has a sort of proportional control. You can use these orange dials to change the speed of the motors gradually. This is useful for trains, but does it work for the servo? Godt, as you see here it sort of works, but in reality it is not very useful to control a car. The main reason is the speed of control. It is actually too slow. The other reason is the lack of return to center function. With this remote, you need to press the red stop button. Every time you want the steering to go back to the center position, proportional steering only arrived for power functions with SBrick and BuWizz. With these Bluetooth controllers, it was finally possible to precisely control the speed and the position of the power functions motors. This solution works great and i use it with most of my remote control modifications. So what about the powered up system actually, which one is the servo there twell there’s no servo and there are multiple servos the same time.
What does it mean instead of a dedicated one, the developers took a different approach. There are three types of motors in the powered up family. I øjeblikket, there are simple, dumb motors with only speed control like the M motor or the train motor there’s, a motor with relative positioning, the medium linear motor that is available in the Boost set. What does relative positioning mean? This motor can measure and report the degree of rotation to the hub, but this position is always relative to the initial position where it was turned on. So the motor knows, if you turn it and can report the amount, but it does not know the exact position. The third type of motors are the ones with absolute positioning. The l and xl motors absolute positioning means that the motor has an internal absolute zero position that can be used as a reference point and is a position to return to. Unlike the power function, servo motor, the zero position is not marked on this motor itself, so it is difficult to tell for the first sight where zero is honestly, it will be more difficult later on, samt, not only for the first sight, so this L motor With absolute positioning is used in the recent Technic sets as a steering servo, you could see it working in the Top Gear rally car and the 4×4 X Treme Off Roader. The behavior is very similar to the power function servo when it is controlled by the BuWizz or SBrick apps, but theoretically it has much more positions, since the Powered Up motors can be rotated even by one degree.
So the new approach seems to be a great improvement. Isn’T, it well it’s all fun and games if you use the official sets with the official Control profiles, but once you want to build something custom, then life becomes much more complicated. The only official way to create custom controls for Powered Up hardware is the free play coding area of the Powered Up app, since it has more than 100 different code blocks. This should not be a challenge, but unfortunately there’s no code lock available. Currently that has access to the hardware encoder of the motors. This means there is no easy return to center command. You cannot replicate simply the core functionality of the power functions. Servo motor, we don’t know exactly how the calibration processing the Control app works, Men, based on my theory, the app measures, the left and right positions of the motor first and based on that data selects the zero or the 180 degree position of the hardware encoder. That falls between the two extreme values then sets that as a relative zero position, since we don’t have access to the absolute zero position in the Powered Ip app, i had to create a workaround in my code, so here you can see that the two extreme positions Are measured, then it calculates the middle position between them and slowly turns the motor to that position. The decreased speed is important, since the motor has an annoying overshoot effect. If it is rotated with a higher speed, this position will become the relative zero.
There are further refinements than to avoid the trembling of the motor. It is only triggered when the slider is moved, so there are a lot of things going on here for a smoother experience. Som du ser, without the calibration sequence, the zero position will be always the one where the motor is when it is powered on. If you can live with that annoyance, then it is actually quite easy to create a simple code that uses the powered up remote to control a car let’s, try it with the rally car. Now this code is pretty simple. These commands are triggered when the different buttons are pressed on the remote. The first column is for the steering there’s a default state with zero center position, where no button is pressed. This is used for the return to center function. The plus and minus buttons will rotate the engine by 90 Grader. The second column is used for the acceleration again, a ‘no button, press’ status with zero speed, full forward and reverse, and the red button is used as a brake. This is the most simple setup. I could come up with and i would say it works pretty. Ok, obviously we lose the proportional control for both steering and the acceleration, but at this size it’s not that noticeable. I would not use it for a bigger or more complicated build, but i guess it’s. Fine to play around with this car, so the biggest drawback is the lack of calibration and centering it’s, not a problem.
If you first do the calibration with the Control app first and then you switch to the Powered Up app and simply use the remote. The only thing you need to pay attention to is to have the wheels centered when you disconnect the hub and leave it in that position until you connect again if the wheels are turned while the hub is not connected, then this will become the relative zero and The center position, so it’s, not good in this case, disconnect the hub align the wheels manually and then connect it again. So when can we have a simple and easy to use official return to center servo solution for Powered Up i’m? Not sure, but i hope the developers feel the need and will come up with something soon until then you can either use my calibration and control code or use this simple solution with the remote i added the simple code to the custom car control pdf. You can find the link, above or in the description i also adjusted the code for the 4×4 X treme Off Roader. You can find that one as well in the pdf it’s actually quite fun to drive it around outside with the remote. If you have it, then i highly recommend to give it a try, it’s not as sophisticated as the solution with BrickController 2 and the gamepad. But if you want to use the LEGO remote and the official LEGO app, then it’s still a playable solution with the Powered Up app.
You can also customize the code. You can add a simple light or you can create a more advanced code for flashing lights. Turn signals: there are many possibilities. You can even use two cars and two remotes using a single smartphone or tablet, as the Powered Up app now allows a simultaneous connection to four hubs or remotes. Please let me know in the comments. What do you think about this control solution? Is it okay to use, and you don’t need a complicated code with calibration and everything or you would prefer a more sophisticated solution? I would like to know as well. If you think this solution is good enough compared to power function, servo or you still prefer to use the previous system. If you like this video, then please give it a thumbs up. You can also subscribe and tap the notification bell.