Adding CC motor

hello ya’ll. so im new to these v3.9 proffie boards. my issure is getting the 47rpm micro motor to work on a master chassis.

Ive seen thread from 2 years ago but not enough info for me figure out a fix

After working a few days and ive finally got all the leds to fire up but now i cant seem to figure out he motor, Prof says to not use the 3.3v but how do i code the motor to use just the pin 6 and straight voltage.

here is the config that works so far
Data 1-4 are being used
Pins 1-5 are used

};
BladeConfig blades = {
{ 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<10, blade3Pin, Color8::GRB, PowerPINS >(),
WS281XBladePtr<5, blade4Pin, Color8::GRB, PowerPINS >(),
WS281XBladePtr<1, blade2Pin, Color8::GRB, PowerPINS >()
, CONFIGARRAY(presets) },
};
#endif

You need to specify the motor as if it were a standard LED, i.e. no data line needed - just a positive and negative (LED power pad) and then the blade style sets how much power gets delivered to it and therefore sets the speed. You also haven’t told the Proffie which LED powerpins you’re using for your various blades/accents.

So to correct it, the bottom of your config might look something like this, with a struct added that tells the Proffie to potentially deliver full power to the motor. (You can use the struct to build in voltage protection, but one of the guys with better theory knowledge than me would be able to expand on that):

//  MOTOR
struct Motor {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 1000.0;
  static constexpr float P2Amps = 0.0;
  static constexpr float P2Volts = 0.0;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

BladeConfig blades = {
{ 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<10, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin1> >(),
WS281XBladePtr<5, blade4Pin, Color8::GRB, PowerPINS<bladePowerPin4> >(),
WS281XBladePtr<1, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin5> >(),
SimpleBladePtr<Motor<0>, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>(),
CONFIGARRAY(presets) },
};
#endif

Then you would add a blade style to each preset along the lines of:

StylePtr<Layers<Rgb<255,255,255>,InOutHelperL<InOutFuncX<Int<300>,Int<800>>>>

Withe above style, the motor would spin at full speed, because you’ve specified Rgb<255,255,255>, i.e. full power. But if you wanted it to spin slower, you might use something like Rgb<100,100,100> instead. Bear in mind that because the motor should be connected to battery+ rather than 3.3 volts, that it will need to operate with a range of voltages from 4.2 down to around 3.2 volts. Therefore you need to pitch it so it’'s not too fast at 4.2 volts but not too slow at 3.2 volts, and the only real way to do it is by trial and error.

Hope that helps.

2 Likes

thanks so much exactly what i was looking for ill try it now!

to many errors to list. anyone have a full config of a successful install of the CC motor on the proffie 3.9

would really help me see my error’ed ways. thanks for all the help

Paste your entire config into pastebin.com, then share the link here so we can take a look at it. Lots of error messages doesn’t always equate to lots of actual errors as they can get kind of compounded.

1 Like

You can just use CH3LED instead of this. Does the same thing.

1 Like

I know ProffieOS keeps rough track of battery voltage… is that used for these calculations or not? I’ve not delved that far into that stuff.

If so, then creating a special motor-specific control struct doesn’t seem like a bad idea, of course one would need to measure useful values for it though.

It does, but it’s tuned for LEDs, not sure if it would well for motors or not. The Motor struct shown above doesn’t use any of that, which is why CH3LED would do the same thing.

thansk everyone! thru process of elimination i figured this line of code was screwing me all up

WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),

simplified the code and got this to work finally

ill check it out, thank you sir been workin on this for almost 2 days. the joys of being a noob

Thanks Prof.
Yeh I know there are various different structs built into the OS, but I have different ones I use for different types of LEDs/Bluetooth modules/motors etc., so I like to keep them right in front of me where I can access/refer to/tweak them easily. :slight_smile:

hello again. so update. rebuilt the code up and uploaded succesfully, but suddenly got a font directory error. guessing i was missing a link in the address to that motor line. i did find i was missing a file for the “simple clash”. i can post what i have so far.

after talking to Khal from saber armory he is gonna send me is config. its for V2.2 board but was hoping to be able to compare and maybe tweak. once i find a fix ill post it on here. hopefully help new people building these master chassis from goth. basically want a preset base that works to test components before i build the thing for good.

heres the font error code only dif between a working one was the lines for the motor

and it works!!! motor comes on with the button only. wired to main power and pin 6

ok so hopefully this helps others test before they build/test a Master Chassis. to start i dont have it all together. just a test rig. but…
heres a working code with “preset fonts” and sounds on the proffie V3.9.
nothing fancy just enough to test all the led strips (2 each top and bottom) , crystal chamber led, and cc motor servo. the motor is hooked to main power(not3.3v) and data6 with no resistor.
it spins at a constant speed and doesnt slow on clash, and only come on with button activation.
ive tested it and everything hooked up works so far.