Remote control from smartphone
3r3-31. In two previous articles, I talked about using a smartphone to control a toy car, either directly with the voice or using another smartphone via Bluetooth. But management was primitive - the team was given, the car carried out the command, stopped and waited for the next command. This was due to the high speed of the car for room conditions (approximately 1.2 m /s), as well as the long time the command was given and the inability to quickly intervene in the movement using the menu. Even the regular remote control did not give control. In the new version of the remote control with a graphical interface, I decided to use PWM to adjust the speed and simulate steering.
The picture shows the machine, which controls the smartphone, and below the smartphone with a running remote control program for bluetooth.
At the top of the screen is a slider (green circle) moved by a finger.
When you remove your finger from the screen, the relative distance from the slider to the left edge of the screen is transferred to the control smartphone, where the latitudinal modulation of the pulse signal is formed.
GR.GET.POSITION c? xx, yy
r6 = (xx-xc) * (xx-xc) + (yy-yc) * (yy-yc)
The smallest signal ratio of 20%, the largest 80%. The theoretical possible frequency is 10 Hz. In fact, probably around 4 - 5 Hz, since the signals for modulation go in the general flow of commands, and some of them also have a time delay. Therefore, at a low duty cycle, vibration is clearly visible.
Two green buttons - upper forward movement, lower back. On the right red button - to stand still. Two white buttons - stop programs on the remote control and on a typewriter. At the bottom of the screen are three purple buttons to choose the direction of movement to the left, right and right. With 3r3121.
on, the corresponding mode, in the center of the button appears a circle of smaller diameter and the same, but darker color. To control the direction of motion in addition to the buttons, I also used the accelerometer. In the horizontal position of the smartphone, the projection of the gravitational acceleration vector on the axis 0Y equals ? which corresponds to the movement straight (see figure above).
If you lift the left side of the smartphone, the projection will be with a + sign, which will correspond to the movement to the right.
If you raise the right side with the sign - that will correspond to the movement to the left.
The program reads the accelerometer and sends the corresponding commands to the smartphone driving the car, displaying the mode on the buttons.
SENSORS.READ ? sx, sy, sz3r3-3202
IF (sy <=1)&(sy> -1) & (lrsh) THEN
rsh = 1
lsh = 1
lrsh = 0
IF (sy> 2) & (rsh) THEN
rsh = 0
lsh = 1
lrsh = 1
IF (sy <-2)&(lsh) THEN
Lsh = 0
Rsh = 1
This is how the remote control works. The work of the car control program has also changed, but not very significant. In the future, I want to supplement the program with the functions of memorizing commands and executing them automatically.
It may be interesting
Corvus Health provides medical training services as well as recruiting high quality health workers for you or placing our own best team in your facility. Check Out: Health Workforce Recruitment
I.T HATCH offers a wide range of IT services including remote access setup, small business servers, data storage solutions, IT strategy services, and more. Check Out: IT strategy services