1
$\begingroup$

I'm working on a ball and beam project where I'm using an IR sensor to find the distance of the ball along the beam and use a PID controller on an Arduino to control the servo motor and balance the ball in the center of the beam. However, I'm now trying to achieve another task: I'd like to place a cup anywhere under the beam, and place another sensor to detect the location of the cup. Then, based on the location of the cup, I'd like the beam to rotate appropriately to land the ball inside the cup. Here is an illustration of what I mean:

enter image description here

I'm unable to figure out how to start or how to do the calculations for the projectiles, since everything seems to be a variable. The x & y variables (distance from ball to cup horizontally and vertically, respectively) depend on the angle of the beam. The velocity of the ball also depends on the angle of the beam: The higher the angle, the faster the velocity is (assuming the ball starts from a set point, such as the center). Finally, the angle of the beam itself is variable and depends on the location of the cup (the closer the cup is, the higher the angle needs to be). How do you suggest I approach such a problem to find the equations needed to ensure the ball lands inside the cup? I'm assuming I'd have to fix one of those variables or make some sort of assumptions to eliminate some of them, but I'm unsure of how to start.

$\endgroup$

1 Answer 1

1
$\begingroup$

You do not need to make additional assumptions, if I did not make a mistake, the solution is completely determined by the information you provided.

Firstly, I use the symbols defined in the following figure:

inclined plane symbol definition

and a time scale so that the Ball is at rest at $t = -T$, it rolls off the beam at $t=0$ and enters the cup at $t = \tau$.

This means, the ball's coordinates at $t = -T$ are $$ y(-T) = x(-T) \sin \theta + h~, \qquad x(-T)~, \tag{0} $$ the latter of which you measure. We also know $$ y(0) = - l \sin \theta + h~, \qquad y(\tau) = 0~, \qquad x(0) = -l\cos \theta~, \qquad x(\tau) = - b~. \tag{1} $$ The kinetic energy at $t = 0$ is $$ E(0) = (y(-T) - y(0)) mg = \frac 12 m v^2(0)~,\tag{2} $$ with $v$ being the total velocity at that time. It holds $$ \dot y(0) = v \sin \theta~, \qquad \dot x(0) = v \cos \theta~. $$ $$ \Rightarrow v = \frac{\dot y(0)}{\sin \theta} = \frac{\dot x(0)}{\cos \theta}~. $$ Plugging this into (2) yields $$ (y(-T) -y(0)) mg = \frac 12 m \frac{\dot y^2(0)}{\sin^2\theta}~, \qquad (y(-T) - y(0)) m g = \frac 12 m \frac{\dot x^2(0)}{\cos^2 \theta}~. $$ $$ \Rightarrow \dot y(0) = - \sqrt{2 g \sin^2 \theta ~ (y(-T) - y(0))}~, \qquad \dot x(0) = -\sqrt{2 g \cos^2 \theta ~ (y(-T) - y(0))}~. \tag{3} $$

Further, $\forall t \in [0,\tau]$: $$ y(t) = \frac 12 g t^2 + \dot y(0) t + y(0)~, \qquad x(t) = \dot x(0) t - l \cos \theta~. $$ Using (1) and (3) I obtain $$ y(t) = \frac 12 g t^2 - \sqrt{2g \sin^2 \theta ~ (y(-T) - y(0))} t - l \sin \theta + h~, \qquad x(t) = - \sqrt{2 g \cos^2 \theta ~ (y(-T) - y(0))} t - l \cos \theta~. $$ Again using (1) I arrive at the equations $$ y(\tau) = \frac 12 g \tau^2 - \sqrt{2g \sin^2 \theta ~ (y(-T) - y(0))} \tau - l \sin \theta + h = 0~, $$ $$ x(\tau) = - \sqrt{2 g \cos^2 \theta ~ (y(-T) - y(0))} \tau - l \cos \theta = - b~. $$ And plugging in (0) and, once again, (1) yields $$ \frac 12 g \tau^2 - \sqrt{2g (x(-T) + l)} \sin^{3/2} \theta ~ \tau - l \sin \theta + h = 0~, $$ $$ - \sqrt{2 g (x(-T) + l)} \sqrt{\sin \theta} \cos \theta ~ \tau - l \cos \theta + b = 0~. $$

In these equations, everything except $\tau$ and $\theta$ should be known, but the second one can easily be solved for $\tau$, which can then be plugged into the first one to get an equation for $\theta$. Looking at all those trigonometric functions, I assume that equation will have to be solved numerically and in theory there should not be a solution for every possible value of the parameters (e.g. if $b$ is sufficiently large, there is no way the ball will get to the cup).

$\endgroup$
2
  • $\begingroup$ Thanks a lot for this explanation. It makes perfect sense. Would you mind if I include your work in my report? $\endgroup$
    – Zelreedy
    Commented Sep 13, 2021 at 16:39
  • $\begingroup$ @Zelreedy You can find information about the license of my answer (and your question) here. Apart from that, I would prefer to not say anything about how you may or may not use the content of this website, because I am not a lawyer. $\endgroup$
    – sim0
    Commented Sep 14, 2021 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.