Hello
I check the UART with uart.any().
it works very vel but sometimes it returns true, without a message.
Than it prints \xff\xff?
Where is the reason?
UART - uart.any()
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: UART - uart.any()
Without seeing your code it's hard to comment. Is it possible that the device at the other end of the serial link has sent two 0xff bytes?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: UART - uart.any()
I think this not the reason, beacuse sometimes is it one \xff sometimes \xff\xff and somtimes more \xff\xff\xff\xff...
The device is the ESp8266 WLAN Modul.
Is it possible that this is an EMV Error, caused by the Servos?
Thank you for your help.
Edit:
Is the support of the esp-module new? I do not see it yet.
Is there an easy way to check for new messages? I communicate with jquery in a browser.
Edit 30.6.2015:
allway when I move the (connectet) servos on X1 and X2 I get \xff\xff (or more) on UART used from the ESP8266 (Pin Y1,Y2)
Is this an EMV reason or could it be an error of me?
The Distance between pyboard and the servos is about 30cm.
Have somebody any ideas?
Thank you!
Code: Select all
def checkwlan(self):
check= self.__uart6.any() # prüft ob Signale anliegen
print('INFO-WLAN: Neue Anfrage:',check)
if check==True:
selfe.receive()
Code: Select all
def receive(self):
print('DEBUG-WLAN: receive')
read = self.__uart6.readall()
#print (read)
self.__string=str(read) # die eingelesene Nachrricht wird als String abgelegt
print('INFO-WLAN: Empfangene Nachricht:',self.__string[0:60]) # nur den Anfang ausgeben (eine Reihe)
Is it possible that this is an EMV Error, caused by the Servos?
Thank you for your help.
Edit:
Is the support of the esp-module new? I do not see it yet.
Is there an easy way to check for new messages? I communicate with jquery in a browser.
Edit 30.6.2015:
allway when I move the (connectet) servos on X1 and X2 I get \xff\xff (or more) on UART used from the ESP8266 (Pin Y1,Y2)
Is this an EMV reason or could it be an error of me?
The Distance between pyboard and the servos is about 30cm.
Have somebody any ideas?
Thank you!
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: UART - uart.any()
It is possible that you're getting spikes on the UART data line which the UART interprets as a start bit. This would very likely cause it to read the value 0xff. What is the UART data line connected to? If the data source has a high impedance then the wire could pick up spikes. I'd test it by temporarily linking the data line to 3.3V and running the servos. If the 0xff characters appear only when connected to your data source, and only when the servos are running, then you're getting interference. You might need a buffer chip to fix it.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: UART - uart.any()
Hello, Thank you for your answer
I have connectet the ESP8266 WLAN Modul.
I have disconectet the module and the servos work
When I connectet the RX of the pyboard with 3.3V I have no interrupt with uart.any().
When I connect the rx to GND I get an interrupt with \x00.
When I connect nothing I have no problems, too.
So I think It must be an spike, catched from the modul.
I have connectet the ESP8266 WLAN Modul.
I have disconectet the module and the servos work
When I connectet the RX of the pyboard with 3.3V I have no interrupt with uart.any().
When I connect the rx to GND I get an interrupt with \x00.
When I connect nothing I have no problems, too.
So I think It must be an spike, catched from the modul.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: UART - uart.any()
That sounds right. So the problem is almost certainly in the wiring. To avoid picking up spikes, firstly ensure there is a good common 0V connection between all the components - the Pyboard, the ESP8266, the power supply and the servos. Keep the wiring between the Pyboard and the ESP8266 as short as possible - ideally a very few centimetres in length (especially the 0v wire). Ensure that the ESP8266 links only to the Pyboard - in other words don't wire anything other than the Pyboard to the ESP8266. With such wiring you really shouldn't pick up spikes. If you're still getting trouble you could consider using screened cable to connect the PWM signal to the servos. But this really shouldn't be necessary.
Good luck!
Good luck!
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: UART - uart.any()
Some additional tips:
1 - Run power and ground from the battery directly to the servos.
2 - Run a separate power and ground line from the battery to the other electronics.
3 - Twist the power and ground lines for each "run" together.
You may need to add a large cap (say 10uF, 100uF or even 1000uF) near the electronics.
You may also need to add a large cap near the servos.
The servos have brushed DC motors, so its also prudent to add some small caps (0.1uF) near each servo. When I have noise issues with brushed motors, I typically add 3 caps to each motor. One goes between power and ground, one goes between power and the metal case on the motor and one goes between the metal case and ground. These small caps do a wonderful job of filtering out the noise caused by the brushes.
You may only need to do some of these things. Each one will help. You can observe the improvements for each change if you can put an oscilloscope on the power and ground lines near the electronics.
1 - Run power and ground from the battery directly to the servos.
2 - Run a separate power and ground line from the battery to the other electronics.
3 - Twist the power and ground lines for each "run" together.
You may need to add a large cap (say 10uF, 100uF or even 1000uF) near the electronics.
You may also need to add a large cap near the servos.
The servos have brushed DC motors, so its also prudent to add some small caps (0.1uF) near each servo. When I have noise issues with brushed motors, I typically add 3 caps to each motor. One goes between power and ground, one goes between power and the metal case on the motor and one goes between the metal case and ground. These small caps do a wonderful job of filtering out the noise caused by the brushes.
You may only need to do some of these things. Each one will help. You can observe the improvements for each change if you can put an oscilloscope on the power and ground lines near the electronics.
Re: UART - uart.any()
Hello, Thank you for yout Tips.
I Think I have some cold junctions and now it is better.
I Think I have some cold junctions and now it is better.