Please HELP: One Bluetooth/two micros 28X2

Danielpbt

New Member
I am trying to build a robot from which a single Bluetooth sends signals to two 28x2. I have read a lot about it, and i have understood it'S possible ( Between Out of Bluetooth and IN of PICAXES a resistor of 1K)

Besides, i have to connect all 0'sV . I did it, but , in spite fo the two microphones receive the signal correctly, one of them restarts continuously, making a movement that should only happen once. I guess I have not properly connected the 0'sV. Could someone tell me how to do it right, please? I connected 0V between OUTS (C'S); (B'S); and Between INS(A'S)
placaaxe020.pngplacaaxe020.png
I have read things in the forum about a micro restart in cases similar to this, but I am not able to find it now
Thanks in advance
 

Attachments

Last edited:

hippy

Technical Support
Staff member
All 0V signals on the boards will be connected together so it should only be necessary to connect just a single 0V of each board together.

A PICAXE misbehaving or resetting may be a result of power supply collapse, electrical noise, or a program which is not correct.
 

Danielpbt

New Member
Thanks for the information. I reviewed everything, and I had a bad block in the program, but your comment has helped me a lot to review every detail.
On the other hand, in terms of electrical noise, it is true that I have many vibrations of servos on the board sometimes where I have 8 servos vigor VS-2A, https://www.amazon.co.uk/HobbyKing-Vigor-VS- 2A-0-17sec-Booole / dp / B01EE0W6FI, and a Bluetooth HC-06. Are they really removed with 0.1 microfarad capacitors in the motors and in the micro? I bought a 2100mAh (6V) NI-Mh power supply, because I read in another forum that most engine vibration problems were about that.
Thaks again
 

premelec

Senior Member
Have you determined that there is a resetting problem? - by putting an initial piece of code that blinks or squeaks only at beginning for instance... Decoupling may require different physical layout or small series resistors as well as capacitors larger than .1uF... Is it only one servo actuation sequence that gives the problem etc...?
 
Last edited:

Danielpbt

New Member
Thanks for your help.

The restart problem was corrected when I noticed an error in the program. I made a mistake.
But what still worries me are the movements that seem jerky that sometimes occur when the robot has to remain in a fixed position.The sequences of movements seem to do them well, but when having to maintain fixed positions at the beginning or at the end, it makes spasms .Robot has 12 servos, 8 on the bottom board for the movement of the legs, and when vibrating they prevent it from stabilizing correctly.What do you recommend?
Regards
 

Danielpbt

New Member
First of all tell you what comforts me that there are people on the other side .. :)
Attached equilibrioinferior.png the program created by my students with Blockly for picaxe, which as you will see is very easy, just intends to put in a position of balance to the robot.

The bottom board has 8 servos. The others are in the top one, which until now has not given that kind of problems, it is true that it has 6 servos and one HC06 connected

Thanks very much for your help
Regards
 

premelec

Senior Member
There have been quite a few posts in this forum about twitching servos... I would suspect lack of update data to a servo in timely way could be a problem with many servos having to keep updated... there are also dedicated servo driver chips that might work better for you. Be more specific about how much jitter you are experiencing when you expect NO movement... and perhaps a picture of the hardware as it's possible with long leads and wire layout to get crosstalk effects, ground loops and similar difficulties.
 

Danielpbt

New Member
Here I send you the photo of the hardware. I have been reviewing documentation, and I have been drawing conclusions. Please correct me if I'm wrong, but I think the steps I should follow in order and testing each time I finish one of them are:
At the Hardware level:
0) Battery that works well
1) Separate the cables as much as possible
2) Braid them
3) Isolate them with aluminum foil and electrical tape (at least the engines that give problems)
4) Capacitors of 0.1 microfarads between the terminals of the servo, and perhaps between the terminals and the housing (and if the housing is made of plastic?) (Note: I have read that it is convenient that they have at least double their rating of entada)
5) Chips of dedicated servo controllers (I put them here to avoid the economic expense, maybe it's the best)
At the software level:
1) Coming SERVO to initialize and place the servo in its first position, command SERVOPOS for the rest of the movements.
2) Check if there is a lack of data in a servo, which could give a problem in a setup with many servos that have to be updated
Please tell me if you agree.
Thank you and greetingsfrancismenosde1mega2.png
 

Danielpbt

New Member
I just tested 0.1 microfarads in parallel to each of the servos, and another with the micro 28X2. There's still noise Are the capacitors small for what I have mounted (8 servos)? I'm three weeks away from going to a contest and I have to solve this as soon as possible :(
Regards
 

hippy

Technical Support
Staff member
As premelec notes, twitchy servos can be a problem for any general purpose microcontroller including the PICAXE.

Some servo types do seem to be more prone to twitching than others and there can often be improvements obtained by adding delays to a program. It is better to use SERVO commands to initialise then SERVOPOS afterwards to move them, but with a large number of servos there may be more likelihood of issues.

Moving multiple servos at the same time can cause higher current surges and problems but I would doubt the problem is electrical noise so would not expect shielding and separating cables to offer a solution.

One common solution to twitching servos is to take total control over them in the program, provide a timing loop and the individual pulses. For example, for 8 servos, set b0 through b7 as servo pulse widths, then call a routine which outputs a frame of servo data on pins B.0 through B.7 -

Code:
#Picaxe 28X2
#No_Table
#No_Data

b4 = 150
b3 = 150
b0 = 150
b7 = 150
b1 = 160
b6 = 135
b2 = 115
b5 =  90
Do
  Gosub ServoUpdate
Loop

ServoUpdate:
  SetFreq M4
  PulsOut B.0, b0
  PulsOut B.1, b1
  PulsOut B.2, b2
  PulsOut B.3, b3
  PulsOut B.4, b4
  PulsOut B.5, b5
  PulsOut B.6, b6
  PulsOut B.7, b7
  SetFreq MDEFAULT
  w4 = 2000 - b0 - b1 - b2 - b3 - b4 - b5 - b6 - b7
  PauseUs w4
  Return
That's easy enough to do with Basic programming but not so easy to achieve using Blockly.

The code above is untested but is intended to replicate what you have in your above Blockly so it would be worth downloading that to see if it does provide jitter free servo control.

If it does, that might be the way forward. If not it may be a sign that there are other issues.
 
Last edited:

Danielpbt

New Member
Thank you very much for your help.
I have been testing various things with the hardware, so far without much result. I tried the braided cables, the insulation, 100 microfarad electrolytic capacitors in the motors and a 0.1 microfarad ceramic capacitor in the microprocessor. There are still vibrations. It's an exasperating thing, but I know it's part of learning when you get into the realization of a project of this kind. I have to try to find a solution before Monday.
Next I will check with your code. Yesterday I downloaded it in the robot, it did not vibrate, but sometimes it happens and it does it after a while, when I move a servomotor. I have to continue testing it, but I do not understand the code very well (I do not program in Basic, I know something about python) , I will see if I find the blocks that correspond to Blockly, and I will analyze the commands that you wrote well.
I do not understand well"...provide a timing loop and the individual pulses...". If you could clarify it to me a little more, please
I also need to find a way to pass that to Blockly if possible, so that my students can feel fully autonomous and understand what they are doing.
A thousand thanks, I hope I'm not abusing your patience
Regards
 

hippy

Technical Support
Staff member
I do not understand well"...provide a timing loop and the individual pulses...". If you could clarify it to me a little more, please
Basically each servo is controlled by a pulse which is sent roughly every 20 milliseconds. The width of the pulse determines how the servo will position itself.

The SERVO and SERVOPOS tells the PICAXE to generate an appropriate pulse with the appropriate timing so you only have to specify which servo to use and what the pulse width should be. Unfortunately the PICAXE has to do other things as well so it isn't always perfect in generating the loop or pulse timing so you can get twitching.

But you can generate the same pulse for the servo every 20 milliseconds yourself using the appropriate PICAXE code. Because generating that pulse is all the PICAXE is explicitly doing, not trying to run a servo while doing other things, it will be far more consistent and won't cause the twitches which may otherwise be observed.

I also need to find a way to pass that to Blockly if possible
I did think of a way to do it.

You could assign 'varA' through 'varH' variables to hold your servo positions, then call a "Do ServoUpdate" block which just contained a BASIC block which did the outputting of the pulses and created the 20 millisecond timing. Put the call to 'Do ServoUpdate' in a 'do forever' block and that should work just as well as the Basic version. That would be an almost pure Blockly solution.
 

Danielpbt

New Member
Hello again. Although I have not shown signs of life, I've been working on this all weekend. Thank you again for your help.
Study a lot about servos, and their different BASIC codes.
Anyway I made a list in order of difficulty about what were the different possibilities of solution. After going through the capacitors in motors and microprocessor, I opted to change the processor, which for the leg part was a 28X1. I thought about this possibility because in the two humanoids that we are building, the upper parts had not given problems until now, and they were 28X2. Last year I had similar problems with 28X1, but I did not have time to find out what happened. Luckily, without removing the capacitors, I changed the 28X1 for a new 28X2, and the vibrations were removed. I do not know if it is better to support the 8 servos than the previous ones, or that has not yet "suffered too much", so I do not know whether to remove the capacitors or not. What do you think?
On the other hand after understanding the reason for your code (thank you very much), I do not want to stop having it for a solution at a future time, maybe tomorrow :(, who knows? I wanted to ask you also according to the code, if after to use PULSOUT commands to position the engines, we could, in your opinion, use SERVOPOS, or we should continue with the previous ones.
Thank you very much and greetings
 
Top