Powering Non-Motor Unofficial Custom Electronics #1856
-
Hi there. I'm new to pybricks and currently attempting to use it to convert my PoweredUp city hubs into to "dumb" battery boxes which output the maximum voltage as long as they're turned on. From there, the idea was to use said battery boxes to feed power to the additional custom electronics (Blunami decoder boards) that I use to control my LEGO trains, the same way I would with the old Power Functions battery boxes. I expected to achieve this with a simple script that feeds the max voltage to the decoder board by treating it as a simple DC motor, but this isn't working. Despite using the DCMotor() class, the city hub refuses to output current on the port the board is connected to, as if nothing were connected to begin with. Is what I'm trying to do even supported? If so, how would I go about getting the hub to feed power to an unofficial device like this that isn't detected by the hub? And if not, would it be possible to implement a feature to support this in the near future? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
For DC motors, the hub uses a simple detection method to detect that such a device is attached so that you could never accidentally apply the full voltage to something. So you can wire your cable such that it is recognized as one of the DC Motors. Then you can use the For example, see how the ID wires in the train motor are connected to GND and VCC (source). If you do the same in your cable, you'll be able to use the M1 and M2 leads as a normal motor output. Use at your own risk 🙂 |
Beta Was this translation helpful? Give feedback.
For DC motors, the hub uses a simple detection method to detect that such a device is attached so that you could never accidentally apply the full voltage to something.
So you can wire your cable such that it is recognized as one of the DC Motors. Then you can use the
DCMotor
class to power the port at the desired PWM percentage and direction.For example, see how the ID wires in the train motor are connected to GND and VCC (source). If you do the same in your cable, you'll be able to use the M1 and M2 leads as a normal motor output. Use at your own risk 🙂