Robotic arm and gyro with encoder motor


#1

I am attempting to find a way to determine the position of the arm. I decided to use the 3-axis gyro sensor which I placed on the robotic arm.
My simple block code checks the y-axis value and then raises/lowers the arm to a “horizontal” position.

It works wonderful EXCEPT the motor (port 3) never shuts off
robot-arm
I even added a hello at the end of the block, after 2 stop motor blocks. The hello msg is displayed but the motor keeps running. My stopMotor block includes setting RPMs=0 and power=0


Python gyroRead for Z value not working properly
Accelerometer Issues
Compass sensor quit working
#2

I decided to make it even easier.

  1. find out y-axis value
  2. if > 0 then go down 2 seconds, stop, go up 2 seconds, stop
  3. if < 0 then go up 2 seconds, stop, go down 2 seconds stop.
    Initial test yaxis= 39: the arm starts down and never stops.
    second test yaxis=-24, the arm starts up and never stops.

robot-arm1


#3

This test and further thinking outside the box and I have an answer BUT not a solution. I removed the gyro code from mblock and manually enter a value for y-axis. 30 if arm is above horizontal and -30 if arm is below horizontal.

robot-arm3

Testing still resulted in the motor not stopping.

I then unplugged the RJ25 cable from the gyro sensor but kept the cable plugged into the shield port 6. Voila everything worked. I then replugged in the sensor and the trouble returned.

Ultrasonic in port 7 and line follow in port 8

I am using eight 1.2V 2600mAh teneregy rechargeable batteries and my multimeter reports over 9V of power coming out of the battery holder.

The robot has no problem running an oval track using the port 1 and 2 motors, the three sensors plugged in. I use the ultrasonic to detect the wall.


#4

I had problems with the gyro sensor… it was not actually producing a value so my test conditions all failed. Turned out I had to turn on the megapi, then connect the serial cable, then read the sensor to make it work correctly.


#5

Pgchurch:
Maybe I did not explain my problem correctly.
I have NO problem receiving values from the sensor.
The problem appears to be a conflict between having the gyro sensor plugged in and running a motor on port 3.
My first post has code receiving values from the sensor.
My second post was a more simple program receiving the values from the sensor.
The third post removed any code asking the sensor for values. If the sensor was not plugged in the arm moved properly. If the sensor was plugged in the motor would not stop.


#6

Here is a link to what happens.
when the gyro is plugged in
https://1drv.ms/v/s!AiELAs3hBGHIjRzxBANgcTYqAB5E
and when I unplug the gyro and run the same sketch
https://1drv.ms/v/s!AiELAs3hBGHIjRsOQI2Tu1i6yZkx


#7

Hi rojoamigo,

Here I can’t see your example programs you pasted, it looks like it doesn’t show.
Here I tried connect the Gyro sensor to Port 8 on Megapi, then run the following program:
image

The ARM move and stop normally according to the program (will send the video to your email address via pCloud transfer). How about you try the same program? Please upgrade firmware for the MegaPi before running the online program.
If the Gyro value is not normal, you can restart the megapi board (turn power switch to off, then to ON) have a try.


#8

Welcome back tec_support:
I ran your program on port 6.
I started the arm at the horizontal.
In repeat 4, the arm went down and hit the controller.

I ran it again and here is the video:
https://1drv.ms/v/s!AiELAs3hBGHIjR3wMrv6M0U4pIae

I then disconnected the gyro, removed the say statement and the program ran correctly.


#9

Hi rojoamigo,

Thanks!
Here I tested with port 6, and still no problem.
May I know which version is your Gyro sensor? (you can check on its back).

Normally, if your program is correct, for this phenomenon, the gyro sensor maybe faulty, but you mentioned that it doesn’t affect the motors connected to motor port 1 or motor port 2, this is wired.
Could you add my Skype account (1021306172@qq.com), then we can have video chat to view all your programs, operations and behaves on the robot? We are available from 9:00~18:30 on working day, China time, please kindly let me know your available time.


#10

The gyro is v1.1 It came with the electronics add-on pack.

I made your program simpler.
robot-sat

With the gyro NOT connected, I can click on this many many times and it works.

However if the gyro is plugged in, this is what happens:

https://1drv.ms/v/s!AiELAs3hBGHIjSCKoQtbJExdTg2i

I unplug the gyro and I can click on this many many times and it works.

note: I never reference the gyro in the program.


#11

Hi rojoamigo,
Test the same program with you on gyro sensor v1.1, the abnormal phenomenon doesn’t appear.
Do you use the latest version mBlock 3.4.11?

Besides, please try clear the cache on the mBlock, then upgrade firmware for MegaPi and test it again.
image

Also, do you meet the same issue if you upload the program to the MegaPi and test it in the offline mode?
image


#12

Yes I am using mblock 3.4.11.

I cleared the cache and upgraded firmware.
note: when you clear the cache, you have to re-select megapi under boards as it defaults to mbot.
What is stored in the cache?

The online test failed on the second click of the program. It appears to be related to the gyro being attached to the arm.

I ran the program in offline mode and it worked correctly. This means the power is cycled on/off with every equivalent “click”.


#13

Hi rojoamigo,

It is normal you need re select megapi after cleared the cache, since the mBlock will restart and recovery to default settings. The cache remembers some settings. We just want to decrease any interference by clearing the cache.

For this issue, we may locate the problem on the gyro sensor or the mBlock software since the offline mode works. Do you have other Gyro sensor have a check with mBlock 3.4.11?

Besides, how about try it with the experimental version mBlock 4.0.4 which can be downloaded from this link.


#14

No I do not have another gyro sensor. The nearest dealer is 4000km away.

It took me a few hours to install mblock 4.0.4 as Norton antivirus deleted it as soon as I downloaded it. I eventually installed it on another windows 10 computer.

With the gyro attached to the arm and plugged in, mblock 4.0.4 will not run the following program correctly, even once:

gyro%20with%20mblock%20404


#15

Back to testing mblock 3.4.11 with your program.
I added an outer repeat 5

With the gyro attached to the arm, the test did not work.

With the gyro on an acrylic pad attached to the arm, it did work.


#16

Hi rojoamigo,

Glad to hear that you figured out the cause.
Could you take a clear picture to show the back of your Gyro sensor? We will check if there is any white silk screen damaged.


#17

As per your request.

I will test to see how small a “pad” I must use.


#18

Hi rojoamigo,

Thanks for providing the picture, from the picture, the white silk screen looks okay.
I will also provide feedback of this issue to our engineer for further analyzing.


#19

Hello rojoamigo, I am intrigued by this problem. I do have the Ultimate kit
and am having a problem with the ultrasonic sensor on the arm.
Could you possibly share your code with me, so I can check where
I am going wrong? my email is willie.senekal@yahoo.com
Thank you very much. Like you, I am many kms from a supplier and
cannot easily get replacements or other users in the area.


#20

a piece of cardboard which totally covered the screened area and underlying metal worked. I am receiving interesting comments from co-workers.