Help needed in designing system

Not, sorry. Due to the shortage I heard you cannot even order a Dagor board. Did you contact the person?

Not yet, I wanted to verify from the community first that it was indeed a good idea.
Damn, it looked like a compact nice little driver board, with embedded sensor and ESP32.
Hey @David_Gonzalez, have you got any on stock? If it is a good match for my project, I’d be interested in purchasing 5 units

I agree Dagor boards would be perfect for you.

If none can be found, perhaps you can consider a SimpleFOC shield paired with an ESP32 in Arduino format (they exist). If all else fails, you can wire a ESP32 DevKit board to a driver board using jumper wires.

Perhaps I can help with some software examples for ESP32 if its helpful to you.

One thing you can look at in this context is OSC - could be a nice protocol for this type of application, although simple UDP packets or a ASCII TCP stream would probably work just as well…

@runger

Thanks. One option (last option) would be that @Sindel orders a hackjammer or a mosquito, these are fully integrated boards. All components are in stock. However this means he has to wait for JLC to manufacture the boards, and the hackjammer is not exactly very cheap, and a total overkill for the job. Also he has to program them with an SWD dongle. Again not really very straightforward, needs soldering.

In this case, he will still need an external ESP32 but in case of using a fully integrated board the WiFi on those off-shelf boards and connecting to the hackjammer is trivial, just a Serial. ESP32 Wroom are widely available and cheap.

Let’s see where this goes first. I already had 5 mosquito boards ordered, but they come without angle sensors, so that’s yet another problem. I may be able to pre-program and snail mail those? Wow that would be messy.

Also, @Sindel will need a 3D printed setup to hold the entire system, who’s going to do that? Combining the motor, spool, angle sensor and boards in a custom box is a non-trivial mechanical project by itself. You can’t just tape this together with sticks and glue.

Hmmm…

Cheers,
Valentine

We all want more Dagor boards! including me :frowning:
I’m looking into alternatives for parts, but can’t make any promises. Options are very limited and volatile.

I’ve used a SimpleFOC shield with a ESP32 devkit and jumper wires. Totally an option!

MP6530 driver ICs are available, perhaps they can be a nice replacement. I have ordered those and soon will be experimenting on them.

Hey all, thanks for the great support!
To answer your questions:
I have a ST-Link programmer so I can program boards if needed.
I can solder, both THT parts and SMD (with soldering iron mostly). I have a rework station as well, although it’s not my forte.
I also have a 3D printer, and I designed the spool system and motor holder for the previous (DC motor based) version of the system. I design parts in TinkerCad, so nothing fancy really.
@runger I have used OSC for many projects, it’s a great protocol! Is there a specific example you are referring to for FOC?
I cannot really choose which combination of boards, I don’t have enough expertise on the matter.
If the SimpleFOC shield is a good option then I could also opt for that. No need to complicate things if unnecessary.
Let me know your thoughts and thanks again!!

Hey @Sindel ,

There’s some OSC examples in the SimpleFOC library’s examples directory - like I said I’m not sure it makes sense in your context, but if it does then it could be an easy way to talk to other devices or existing software.
Basically there is a OSC library for Arduino, and using it you can send/recieve OSC messages via UDP on an ESP32, since it has WiFi.
I also have code around setting up WiFi, OTA updates and announcing to mDNS (Bonjour), all of which I’m happy to provide if it’s helpful.

But I think your first-order thing is finding some drivers/ESP32 combination you can work with.

1 Like

@Sindel

This is my take on the setup, with what I have and what I know.

  1. Motor ($19)

Brushless-Efficiency-Drones-Gimbal

  1. Sensor and magnet ($16):

https://www.digikey.com/en/products/detail/ams/AS5047P-TS-EK-AB/5452344

  1. Board (about $10)

  1. ESP32 Wroom ($10)

HiLetgo-ESP-WROOM-32-Development-Microcontroller-Integrated

image

  1. Off-shelf commercial WiFi router (assume you got it)

  2. Off-shelf notebook (assume you got it)

Each setup is approximately $60, before tax, shipping, 3D printing, extra cables, power supply, etc.

I have 5 alpha-version mosquito boards, you can power them up with the Wroom, because I messed up the LDO and one of the pins, but they are working.

This is how they look

Hey @Valentine thanks for the parts list and the diagram!
The Alpha Mosquito boards are the ones without the angle sensor, right?
How much would you charge for shipping to the Netherlands?
Ideally I’d like to try just one, to see if the whole system works, before scaling to 5.
Ah, I usually use the ESP32-Pico instead of the WROOM, but I guess it shouldn’t be a problem.

@sindel

PM/DM me on the board.

Cheers,
Valentine

Hi there!

Cool project!

Maybe I’m missing something but to keep things as simple as possible you could use a spiral spring
for the spool that keeps on rewinding the thread. Maybe you know that feature from that old vacuum cleaners that spool the cable in automatically. You could also add a wireless button for a break if you need to.

Hey, @Lukas, I had the same thought, but I assume @Sindel has a reason for using the motors…

if not, then a simple tape measure from the hardware store is a possible source for such a spring in a compact package - you could probably just replace the tape with a spindle and some string…

Hey there!
Vert legitimate question! And it’s the same idea I had at the beginning of the project.
And I obviously tried it by using a tape measure, but I warped the spring very quickly.
Also I need something that can provide at least 30 meters of thread. Tape measures are usually around 10 meters of extension.
I don’t know if I’m missing any easier method, but after this failure I thought to go the electronic way and got myself some DC motors. And now hopefully I’ll transition to BLDC.
I love the creative thinking on this forum! Thanks for your input!

Your other problem would be, basics physics, that as you wind the spring, the force coefficient will gradually increase and the force to unwind will increase, and at the end you will chop your head off especially when you have to unwind that long distance. You could avoid this by designing a clock-like mechanism where the force is constant (similar to the way clockworks are designed) however mechanically this is way too complex. Also you still need the angle sensor electronics to communicate the angle wirelessly.

Using a brushless motor is perhaps the lesser of two evils.

1 Like

The way you usualy get constant tension is with some sort of, well… tension measuring device, either you use tensometers or you use a dance roll (pun not intended).
Dance roll is simpler to implement.
How it works is this - you have a potentiometer that changes its value with the angle of the dance roll arm, at the end of the arm you can have a small weight (usualy you would use a proportional pneumatic cylinder to keep calibrated counter force on the arm).
Your thread will go around a pulley at the end of this arm.
What you do now is this - you set up a PID controler that tries to keep the angle of the arm constant (to keep the voltage read from the potentiometer constant). This PID controls speed of the motor.
Done - the control loop will now keep constant tension on the string.

BTW what is the purpose of the string in this performance? :smiley:

EDIT1: Added a drawing:

EDIT2: I forgot to tell - with this method you don’t need a BLDC, the DC motors should be sufficient, you just need a H-bridge like the venerable L298M. This is because the feedback from the dancer is sufficient to control the whole thing.

EDIT3: Or just ditch the position and speed loops in SimpleFOC and put some constant value into Q voltage PID, put 0 into D current PID input (you dont need field weakening for this), this desired value of Q current will control motor current, this is directly proportional to torque - you control the winding torque, you control the tension. This way there is no need for any measurement device.

Thing is if the line has slack or breaks the motor will want to wind very fast (in all of these methods).

Well, you can do it in plain software as well, no need fo external hardware (if you have current sensing). Below is a piece of my code for demonstration, which does exactly what you are looking for. Take it as pseudo code, I deleted a lot of my specific code and removed the setup and motor/sensor definitions. Also, you probably won’t need any communication with a central controller, if the strings for all actors should just be pulled with constant force, which would eliminate all the Wi-Fi equipment and communication code. The concept is to use SimpleFOC in Angle mode and to limit the motor torque by setting a current limit (without further a do, it would then act like a spring). In the loop function you sense the current, if it exceeds your set limit, the dancer pulls the string and you set the angle to the position to where the dancer pulled it. If the current is lower then set, the rope is looser and you correct the angle a few degrees in the opposite direction, which pulls it again. Works perfectly fine in my application. You will need to adjust some parameters of course, especially the correction of a loose rope and how frequent you call that code needs to be adjusted to be really smooth, but that is easy. If you miss something essential in the code excerpt, just let me know.

Have fun with it,

  • Chris
//*************************************************************************
//*************************************************************************
/*
		WARNING: This code is incomplete, just showing the concept of
		pulling a string with constant force.
		
		Most of the SimpoleFOC standard code and setup is left out.
	
*/
//*************************************************************************
//*************************************************************************


#define RADIUS    		0.01				// Radius of spool in m
#define TORQUE2FORCE(T)	((T)*1.0F/RADIUS)	// Convert Nm to N 	
#define FORCE2TORQUE(F)	((F)*RADIUS)		// Convert Nm to N 	

// Motor dependent constants
#define IMAX			5.7F	// Max phase current in A
#define TORQUE_PER_A	0.035F	// Torque in Nm per Ampere

// Utility functions
float GetCurrent()
{
	const DQCurrent_s c = GetCurrents();
	const float Current = (fabs(c.d) + fabs(c.q));
	return Current;
}

float GetForce()
{
	float Current = GetCurrent();
	float Torque = Current * TORQUE_PER_A;
	float Force = TORQUE2FORCE(Torque);
	// Serial.printf("Force: %4.1fN\n", Force);
	return Force;
}

// Set the target shaft angle to Angle in rad and move there at speed Speed in rad/s
void ReceivedSetAngle(float Angle, float Speed)
{
	motor.velocity_limit = Speed;
	motor.P_angle.limit  = Speed;
	motor.move(ROT_DIR*Angle);
}

void ReceivedSetAngleMode()
{
	motor.controller = MotionControlType::angle;  
	motor.foc_modulation = FOCModulationType::SinePWM;
}

void ReceivedSetForce(float Force)
{
	const float Torque = FORCE2TORQUE(Force);
	float Current = Torque / TORQUE_PER_A;
	Current = min(Current, IMAX);
	Serial.printf("New force: %.2fN=%.3fA\n", Force, Current);
	motor.current_limit = Current;
	if(_isset(motor.phase_resistance) || motor.torque_controller != TorqueControlType::voltage ) 
		motor.PID_velocity.limit = Current;
}

void setup() 
{
	...
}

void loop() 
{
	uint32_t TNow=millis(); 
	static uint32_t TSPushPull=TNow;
	static float CurrentLP = GetCurrent();

	#ifdef USE_HALLSENSOR
		sensor.update();
	#endif

	#ifndef USE_COMMANDER
		SerialLoop();
	#endif
	motor.loopFOC();

	// LPF currents		
	CurrentLP = 0.7*CurrentLP + 0.3*GetCurrent();

	if (...initialization)
	{
		// Add a homing procedure etc. here!
		// E.g. pull the string until the current rises signifiucantly, then set this as the zero position.
		
		// Once the homing is done:
		ReceivedSetAngleMode();	
		motor.loopFOC();
		motor.move();
		ReceivedSetForce(NEUTRAL_FORCE);
		ReceivedSetAngle(NewAngle, 5.0F);
		TSPushPull = TNow + 100;
	}

	//************************************************************
	// Mimic the bahavior of pulling on the control lines
	if (... initialized && TSPushPull<=TNow)
	{
		float Force = GetForce();
		if (Force>NEUTRAL_FORCE+3)
		{
			// Break pulled
			ReceivedSetAngle(motor.shaftAngle(), 100.0F);
			// Serial.println("Pulled");
		}
		else if (Force<NEUTRAL_FORCE-1)
		{
			// Break loose
			ReceivedSetAngle(motor.shaftAngle()+12, 100.0F);
			// Serial.println("Pushed");
		}
		TSPushPull += 50;
	}


	//************************************************************
	// Motion control function
	{
		// velocity, position or voltage (defined in motor.controller)
		// this function can be run at much lower frequency than loopFOC() function
		// You can also use motor.move() and set the motor.target in the code
		//***  NB: 1rad = 57.3 Grad, 6.283rad=360 Grad, 1000rpm=6283rad/m=103.9rad/s

		#ifdef USE_COMMANDER
			motor.move();
		#else
			// Serial.printf("Setting target to %.1f\n", TargetValue);
			motor.move(TargetValue);
			// motor.move(0);
		#endif

		// function intended to be used with serial plotter to monitor motor variables
		// significantly slowing the execution down!!!!
		motor.monitor();
	}
}

Hi Grizzly,

I am trying to use Can Bus comm with B-G431B-ESC1 and I need help about this. Can you share your solution code / and hardware point?

Thank you.

Dear etempm,
it is currently a bit messy since I added something to the ESP32 version, but I will send you a direct message with the link. I am not a github pro, so we may need to tweak the accecss rights a bit if it does not work out of the box, but we’ll manage.

  • Chris

Thank you very much.