Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted
7 hours ago, gyenesvi said:

ESP32 cannot handle 9V

ESP32 is a 3.3V chip, it needs 3.3V power supply and this is also the maximum voltage for input/output on its pins. ESP32-CAM board contains a tiny voltage regulator so the board can be powered either with 5V or 3.3V, but that does not change max voltage for pins.

The buck converter and the voltage dividers do very different things.

The buck converter handles the DC current up to 1A for the power supply, decreasing 9V from the hub (actually 7.4V since there's 2S LiPo battery inside MK Hub) to 5V for powering the ESP32 board. Converting 9V directly to board's native 3.3V is also possible, and that would be even more effective, but 5V power supply is also used for the GeekServo. @oracid has much more experience with these servos and suggests that direct 2S power supply is also acceptable for the GeekServo, but I prefer to follow electical limitations :)

Resistors in the voltage divider are much more simple, they lower the signal level to 3V so it can be handled by ESP32 and they also limit the current which goes through the circuit (1+2 kOhm resistors take just around 2mA from the HUB, while C1/C2 pins can provide up to 500-800mA for a L-motor)

8 hours ago, gyenesvi said:

Servo class

There's a Servo class in Arduino's standard framework, but it supports only architectures for original Arduinos. For ESP32 boards, there's a different ESP32Servo library (but the class name is the same).

 

4 hours ago, tseary said:

I've done something similar a few years ago

Did you share this anywhere? If it was a kickstarter project, suppose there would be a lot of support!

This is what I really looked for before starting my project! What you've done is really cool! As I see, you've mastered SMT assembly so the board is much smaller than mine. Personally, I'm not ready to do SMT assembly at home :)

 

Posted (edited)
34 minutes ago, LabManager said:

Resistors in the voltage divider are much more simple, they lower the signal level to 3V so it can be handled by ESP32 and they also limit the current which goes through the circuit (1+2 kOhm resistors take just around 2mA from the HUB, while C1/C2 pins can provide up to 500-800mA for a L-motor)

Thanks for the explanation, so basically when using the C1/C2 to power PF motors you need the 500-800mA current, because it directly powers the motor, but when you use the signals to control the servo you don't need much current since that's only a control signal, the servo gets the power on another line, so this is why using the resistors makes sense there, right?

5 hours ago, tseary said:

I've done something similar a few years ago to connect hobby servos to Power Functions. (In the image below, a 2x5 studful Geek servo). This custom PCB has an ATTINY84 microcontroller to read the C1/C2 PWM and drive the servo accordingly. There is also an IR receiver which allows direct control without a Power Functions receiver.

Wow, that tiny board looks really awesome, this is almost what I was thinking. For me it would be enough to have a board that does not have an IR receiver, just the servo controller. For example, that way I could connect the servo to a Technic hub or a Buwizz unit, which does the communication for me already. I agree this would be a popular thing if published. The current form factor seems like 5x3 studs, right? How much of that space is used by the IR receiver, how smaller could that be if it only had the servo controller?

5 hours ago, tseary said:

On the subject of converting C1/C2 to servo PWM without a microcontroller, this is doable... As a rough concept, I would suggest the following:

1. Convert C1/C2 to analog by RC filter. Combine these two signals into one with an opamp subtractor.

2. Generate a PWM for the servo from a 556 timer. (The 556 is two timers. The first produces a constant frequency to trigger the second timer, which is configured as a one-shot).

3. Let the combined analog signal determine the pulse width of the one-shot timer. The result is the servo signal.

There are a number of issues with this approach that are solved by a microcontroller. Foremost is that it would take at least double the space - although it could be a few cents cheaper in volume. :pir_laugh2:

Interesting to know that it could be done in theory (unfortunately I don't have enough electronics knowledge to understand those details at the moment). But if the microcontroller way results in a smaller and less problematic, than it's not worth it (and I might understand that better as a software engineer). So I'm curious about how the microcontroller path could be optimized!? If that little board could be shrunk a bit without an IR receiver for example to a 3x3 form factor, and put into some simple 3d printed housing to feel less naked, that would already be great!

Edited by gyenesvi
Posted

I've made the GitHub repo for my servo controller public, and I also uploaded the KiCad files: https://github.com/tseary/Sergo

The existing design is indeed 3x5 studs. With a smaller microcontroller, single servo output and no IR receiver it could probably fit into 3x3. Maybe I'll look into this tomorrow...

Posted
9 hours ago, tseary said:

I've made the GitHub repo for my servo controller public, and I also uploaded the KiCad files: https://github.com/tseary/Sergo

The existing design is indeed 3x5 studs. With a smaller microcontroller, single servo output and no IR receiver it could probably fit into 3x3. Maybe I'll look into this tomorrow...

Thanks, that sounds interesting! I was wondering if this board already contains a 5V downregulation of the signal which is supposed to be 9V or even higher in case of being powered from a buwizz?

As for shrinkage, I think it would be possible to get rid of the pinholes (or keep at most 1) because a smaller unit does not need that much fixing, and in a housing, it could even just float in the air as well. Or a housing could have inverse studs on it just like in case of a PF plug.

Posted
On 11/8/2024 at 11:57 AM, gyenesvi said:

when using the C1/C2 to power PF motors you need the 500-800mA current, because it directly powers the motor, but when you use the signals to control the servo you don't need much current since that's only a control signal, the servo gets the power on another line, so this is why using the resistors makes sense there, right

Correct!

2 hours ago, gyenesvi said:

Thanks, that sounds interesting! I was wondering if this board already contains a 5V downregulation of the signal which is supposed to be 9V or even higher in case of being powered from a buwizz?

Why would you want to connect a GeekServo to the BuWizz ? Buwizz 3.0 has PUP connectors so you can use PUP L-motor for steering.

Posted
5 hours ago, gyenesvi said:

As for shrinkage, I think it would be possible to get rid of the pinholes [...], it could even just float in the air as well.

Good idea. I was thinking just 2 holes, but if it were small enough it wouldn't need any.

2 hours ago, LabManager said:

Why would you want to connect a GeekServo to the BuWizz ? Buwizz 3.0 has PUP connectors so you can use PUP L-motor for steering.

This is a good point. One advantage of servos over PUP motors is that servos know their absolute position.

Posted (edited)
7 hours ago, LabManager said:

Why would you want to connect a GeekServo to the BuWizz ? Buwizz 3.0 has PUP connectors so you can use PUP L-motor for steering.

Because a GeekServo is smaller, stronger, faster and more precise and have outputs on both ends :) And above all that they are cheaper as well, but that is not the most important advantage for me.

4 hours ago, tseary said:

One advantage of servos over PUP motors is that servos know their absolute position.

PUP L motors also know their absolute position, but it's not marked on the outside, so it is a bit more difficult in that respect as well.

Edited by gyenesvi
Posted
20 hours ago, gyenesvi said:

Because a GeekServo is smaller, stronger, faster and more precise and have outputs on both ends :)

And they are protected in the event of a torque overrun.

Posted
On 11/9/2024 at 1:36 AM, tseary said:

I've made the GitHub repo for my servo controller public

I have been looking at the code you uploaded and kind of understand what it does. However, there are some details about the making of the hardware and the programming that I don't understand yet, so some further info would be appreciated.

First, the making of the board. If I understand correctly you had the the naked board made by an online service and soldered all the components onto it manually (or are there some components that are pre-soldered?), and you have chosen each component to your needs, the main ones being the microcontroller and the buck converter, which you can just buy directly from the manufacturer and look at its docs for the pinout diagram, right? So far so good. Though I wonder if there is an online service which also pre-solders such common components onto a board if you'd like them to?

Second the programming of the board. I see it uses Arduino programming. Typically, Arduino boards have a small USB connector to upload the program to the microcontroller. What I don't get is how you program the microcontroller in this one? Is there some special development board needed that you can plug the microcontroller into and use for uploading programs to the microcontroller before soldering it in? And if so, is it the case that the program cannot be changed after it has been soldered in?

Posted
36 minutes ago, gyenesvi said:

Though I wonder if there is an online service which also pre-solders such common components onto a board if you'd like them to?

Sure, there are services which do PCB assembly (so called PCBA). However this is reasonable for mass production, or at least for small batch ordering. The other point is that PCBA is usually made with surface-mount technology (SMT), and this requires different PCB design using SMD components. In one word, this is too serious for a hobby project. So, unfortunately, for DIY purposes you really need to do some soldering yourself :) 

1 hour ago, gyenesvi said:

Arduino boards have a small USB connector to upload the program to the microcontroller

That's true. But ESP32-CAM is different, it doesn't include USB components to save some space and make the board smaller. Usually ESP32-CAM board is bundled with ESP32-CAM-MB (or you can order it separately), that second board is used for uploading. Here's a link to a tutorial.

Posted

@gyenesvi Sorry, I didn't add any instructions yet. I'll try to do that during the week. A couple of short answers; the board is reflow soldered using solder paste and hot air. The chip is programmed through the ICSP header - this can be done using an Arduino Uno and the "Arduino as ISP" option.

Posted
4 hours ago, LabManager said:

Sure, there are services which do PCB assembly (so called PCBA). However this is reasonable for mass production, or at least for small batch ordering. The other point is that PCBA is usually made with surface-mount technology (SMT), and this requires different PCB design using SMD components. In one word, this is too serious for a hobby project. So, unfortunately, for DIY purposes you really need to do some soldering yourself :) 

Thanks for the info, indeed I could look this up and starting to understand more.

4 hours ago, LabManager said:

That's true. But ESP32-CAM is different, it doesn't include USB components to save some space and make the board smaller. Usually ESP32-CAM board is bundled with ESP32-CAM-MB (or you can order it separately), that second board is used for uploading. Here's a link to a tutorial.

I meant that question about the microcontroller board of @tseary, not the ESP32-CAM board, that one seems easier as it has more connectors.

4 hours ago, tseary said:

@gyenesvi Sorry, I didn't add any instructions yet. I'll try to do that during the week. A couple of short answers; the board is reflow soldered using solder paste and hot air. The chip is programmed through the ICSP header - this can be done using an Arduino Uno and the "Arduino as ISP" option.

No problem, no rush and thanks for the quick answers. Having looked into it, it seems that it's even possible to make such things programmable after being soldered with some suitable pinouts and microcontroller programming boards. Really curious how far this could be pushed.

Posted

@LabManager where did you get the MK servo from? I see MK servos being sold individually on ebay; I'm tempted to get one to experiment with (or dissect) but I'm not sure it's the right kind.

As I understand from your first post, the only thing that changes the servo behaviour is frequency. 470 Hz gives +/-90 degrees, and >980 Hz gives proportional control. Did you try even higher frequency beyond 1200 Hz?

Posted (edited)
On 11/12/2024 at 5:29 AM, tseary said:

@LabManager where did you get the MK servo from? I see MK servos being sold individually on ebay; I'm tempted to get one to experiment with (or dissect) but I'm not sure it's the right kind.

As I understand from your first post, the only thing that changes the servo behaviour is frequency. 470 Hz gives +/-90 degrees, and >980 Hz gives proportional control. Did you try even higher frequency beyond 1200 Hz?

Mine was from a local online store, it was packed in a branded MK retail box with M-0005 item code. 

Here are some pictures of it after disassembly. It looks very similar to the original Lego PF-motor (you can find a video with its disassembly here), at least there are contact pads that could probably work as a 15-position encoder. The PCB components are different, so MK servo is not a 100% copy. I could identify MX612 motor driver and a weird 14-pin chip without any marking on it. The next step could be to dump the firmware from that chip and make some reverse engineering to find what kind of signals it expects, but I'm not 100% sure that it has similar pinout to PIC and even if it was a PIC clone, I just don't have that hardware to read the chip (not mentioning it can also have read protection).

So I just tried to control it with higher frequency signals (up to 2000 Hz), but I could not notice any difference in the way it works. It still rotates to a certain angle, proportional to the duty of C1/C2 signals, but it can't stop at that position and moves little bit around. Probably, as with original PF-Servo, there could be some magic numbers that identify the 15 fixed positions the servo can rotate to, and the signal's duty must match them exactly so the servo can work properly. Or, more likely, MK just cloned the hardware of the original servo, but couldn't (or didn't want to) develop similar signal/encoder processing inside the chip.

 

IMG-9674.jpg IMG-9675.jpg IMG-9676.jpg

Edited by LabManager
Posted
22 hours ago, LabManager said:

Or, more likely, MK just cloned the hardware of the original servo, but couldn't (or didn't want to) develop similar signal/encoder processing inside the chip.

Interesting, to me, so far, this sounds like the most probable explanation of why all clone servos have only 3 positions; they all copied the hardware, but they could not really match the microcontroller software to it.

  • 1 month later...
Posted

Every year I'm trying to solve the same issue that mentioned here - to find an easy way to have a proportional control for steering on lego creations.

This time I've found this thread :)

@LabManager, dude, you did a great job. Several years ago I've ordered several PF connector sized controllers from Wixy creator (can be found on VK) that doing exactly a convertion from MK 4.0/6.0 to standard RC PWM suitable for GeekServo. Sadenly that person refuses to continue work on this kind of controllers. Maybe you will be able encourage him to do that.

Although I'm radiophysist and IT person all this tiny controllers is definitely not my coup of tea. I'm still searching for compact solution that can be simply added to PF output of MK battery to replace standart servo with GeekServo or justr make something available on market to work proportionaly. I'm ready to participate in any initiative

P.S. MK have a lot of defferent versions of boards for 6.0 electronic. Some of them working on different frequencies. Maybe they finally stick with one version as latest sets didn't have a surprises of this kind

Posted

@VladimirU, can you tell more about those PF connector sized controllers? Are those converters for RC servo signal? I know the Wixy thing, but that's a different thing, that was a receiver. Did the same guy also make another product for converting the servo signal? Did you get your order and test it out? Do you have some photos of it? Sounds interesting.

@tseary did you find the time to look into making a smaller version of your converter board?

Posted
On 1/8/2025 at 12:07 PM, gyenesvi said:

@tseary did you find the time to look into making a smaller version of your converter board?

Thanks for asking. I've designed a new minimal version without the IR receiver, and only a single servo output. Using the smallest SMT parts I could manage, the board measures just 12x24 mm. But I haven't ordered the parts yet, as I need to finish some other work before digging into this.

The new design has a different microcontroller, so it will require fresh code.

Posted
1 hour ago, tseary said:

Thanks for asking. I've designed a new minimal version without the IR receiver, and only a single servo output. Using the smallest SMT parts I could manage, the board measures just 12x24 mm. But I haven't ordered the parts yet, as I need to finish some other work before digging into this.

The new design has a different microcontroller, so it will require fresh code.

Thanks for the heads up, sounds really interesting, the size of 12x24 mm is really good, would well be workable for a floating design! Looking forward to more progress when you have time for it!

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...