Building a PC contr...
 
Notifications
Clear all

Building a PC controlled Robot

22 Posts
5 Users
7 Likes
896 Views
ElectricRay1981
(@electricray1981)
Member
Joined: 1 year ago
Posts: 119
Topic starter  

@davee

Posted by: @davee

With a 'digital waveform' like that shown, the normal approach is ensure the hardware reports the timing with respect to the transitions through approximately mid-voltage of the pulses, so that the little spikes at the top and bottom of the pulses are totally ignored.

I thought the Schmitt Trigger would take care of that the speed sensor has the LM393 but maybe I'm missing some important point.

 

Posted by: @davee

This is not a criticism of the scope, but a natural consequence. You say the pulse frequency is about 50Hz, so each pulse top or bottom will have a length of about 10 milliseconds, whilst WiFi data rates are in the MHz, typically 10s of MHz region, and the carrier frequency is 2.4GHz, all of which suggests any WiFi related breakthrough will occur in very much shorter periods of time than that represented by a single pixel of the scope.  Hence the scope will be unable to show the 'real' situation.

Yes this makes fully sense to me. But (if the scope is showing corret values) when I turn on the WiFi connection we start to see the disturbances. because If I don;t turn on WiFi connection thos pulses look pretty good IMHO.

 

Posted by: @davee

I wonder if you have some power distribution issues. ESP32 boards have a reputation of having inadequate decoupling, especially with respect to current demands when WiFI is active. You might like to investigate the effects of adding decoupling capacitors, etc. Unfortunately, this can be quite a tricky problem to investigate and fix. 

This could be bullseye, I'll explain why this might be a good suggestion. Whe I carry out tests I supply the controller (i.e. the ESP32) by USB cable. When I do a test run so control the bot over wifi without any cable connected I use the 7805 the ciruit is shown in the fisrt post except a capacitor at the input of the 7805.
But when using the power supply so not from the USB cable I noticed today that the 7805 is getting pretty warm (I'd call it hot but below 50 degC cause I could touch it without burning my fingers).

Posted by: @davee

You might like to investigate the effects of adding decoupling capacitors, etc. Unfortunately, this can be quite a tricky problem to investigate and fix. 

I would like to investigate this but I would not know how to start testing this. My background is with High Voltages and High Currents. At the moment im doing a course about analoge electronics so this involves transistors, OpAmps etcs just to know more about electronics this has never been a major in my curriculum and I would love to learn more about it.
So I know that for example if you want to use a transistor for AC amplification one should use an uncouple capacitor. I understnad the theory behind it. It's all about 1/WC (read W as Omega) so the higher the frequency the lower the Xc resistance. Ok but how would I start uncouple correctly the ESP?

 

Grtz,
Ray


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

 

Posted by: @davee

I wonder if you have some power distribution issues. ESP32 boards have a reputation of having inadequate decoupling, especially with respect to current demands when WiFI is active. You might like to investigate the effects of adding decoupling capacitors, etc. Unfortunately, this can be quite a tricky problem to investigate and fix. 

@electricray1981

This could be bullseye, I'll explain why this might be a good suggestion. When I carry out tests I supply the controller (i.e. the ESP32) by USB cable. When I do a test run so control the bot over WIFI without any cable connected I use the 7805 the circuit is shown in the first post except a capacitor at the input of the 7805.
But when using the power supply so not from the USB cable I noticed today that the 7805 is getting pretty warm (I'd call it hot but below 50 degC cause I could touch it without burning my fingers).

Something to always keep in mind. Is this a software or a hardware bug?

 

 

 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1680
 

Hi @electricray1981,

 Your understanding on Schmitt trigger is along the right lines, though maybe not exactly right.

  All digital logic inputs should ignore noise peaks when the voltage only deviates by a small amount from the high or low voltage level. The actual range of voltages that are ignored varies widely with different logic family designs ... it is very much a case of read the data sheet.

This applies to devices with Schmitt triggers as well, but they also have an enhancement. The transition voltage is enhanced so that the low-to-high transition is at a higher voltage than the high-to-low transition. The aim being to reduce the chance of a noisy, slow transition being interpreted as multiple transitions. 

Thus, in the case of your optical encoder, as the 'fan' blade slowly moves in front of the detector, it reduces the chance of multiple transitions whilst the blade is roughly halfway between the divisions.

Note the Schmitt trigger does not significantly increase its ability to reject noise when the voltage level is close to the high or low level, compared to other chips in the same "family".

As I said above, even for a given power voltage intended for logic chips, say 3.3 V, different "families" have different transition voltage ranges, so when an output from one family drives an input for a different family, care must be taken to ensure the transition voltages are compatible. Obviously, this can sometimes be a challenge when mixing small circuit boards from different sources that do not comprehensively document their products.

-------

I can see your scope is showing some disturbance when you turn Wi-Fi on, but the deviation from the high or low level is only a small percentage of the apparent difference between low and high levels, which would not normally affect the logic level perceived by a digital input. i.e. if the scope is showing the 'complete' picture, the pulses when the WiFi is on, as well as when it is off, are near to the textbook perfect shape ... logic chips can usually cope with pulses with much more shape distortion and noise than shown by any of your scope pictures, with very few if any errors.

My suggestion, is that the 'true' deviations might be much greater than the scope is suggesting, so that they are being interpreted by the receiving logic device (e.g. GPIO pin of the microcontroller) as 'genuine' level transitions.

----------------------

Voltage regulators like 7805, usually want a decoupling capacitor on the input and another on the output, with minimal wire lengths in both cases. The data sheet is your best starting point for details, which vary between different devices. Note, the data sheet values are often intended to ensure the regulator remains stable (ie doesn't oscillate). They may not be sufficient for decoupling and filtering as well.

7805 regulators tend to get warm, and if you can touch them, will probably be fine, though adding a small heatsink would probably be a good idea to reduce reliability issues.

------

You seem to be starting to get some of the principles. When it comes to wiring and earthing you probably know some of the principles, but maybe haven't realised they also occur on small, low voltage circuits. For example, current must flow in a loop, and that any resistance or impedance will result in voltage drops. High voltage circuits are often DC or low frequency, say 50Hz or 60Hz, so even long distance cables have modest inductance and capacitance reactance effects. At the frequencies chips like ESP32 work, even a few millmetres of wire have very a significant effect.

---------

Hope this helps and best wishes, Dave


   
ReplyQuote
ElectricRay1981
(@electricray1981)
Member
Joined: 1 year ago
Posts: 119
Topic starter  

@davee 

I think I thought about other decoupling capacitors  somewhere else in the wiring (sorry for misunderstanding) now when you wrote about the 7805 capacitors on the input and output they are there but hard to see on the pictures I posted.

Next week I'm in Marseille for a job and I have limited internet access and can't continue with the project. But I will try to make a full schematic drawing of how I hooked up all.

But I think the speed sensing is working ok and can leave this as it is. I have comered the scope reading with what the software tells me and those speeds are darn close to eachother. I don't think I need to change things here anymore and your proposed smoothing algorithm work good and fast (faster as those filters).

Like @robotbuilder wrote it could be all related to software. Now I beleive that the speed mesurements are ok but when a step is given with only P gain active in the speed control. I think I need to take a look to that and that it is most probably in the software. Even with P only enabled to the measured speed should always reach its desired setpoint (offcourse when the motor is able to run at that speed). 

So next week I can dive into that make some calculations and see if I don't made a mistake in some conversions and find maybe more info about ArduPID.h. 

Grtz,
Ray


   
DaveE reacted
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@electricray1981

Next week I'm in Marseille for a job and I have limited internet access and can't continue with the project.

Enjoy your time in Marseille.

Thinking about your encoder issues has motivated me to play around with some electronics and some low level programming after over two years of lost interest.

I see with your choice of image you must have a penchant for mathematics. Although I struggle with mathematics myself I see it is as essential in fully understanding modern science.


   
ReplyQuote
ElectricRay1981
(@electricray1981)
Member
Joined: 1 year ago
Posts: 119
Topic starter  

@robotbuilder 

Well math is fundamental in all engineering area's. I personally love math it is so beautyfull one can describe real life things with numbers I love it. 

I won't have time to enjoy Marseille because I'm there for work hehhehhe a service engineer never enjoy the place he goes because he arrive to solve issues and when he's done he leaves hahaha.

 

 

Grtz,
Ray


   
ReplyQuote
ElectricRay1981
(@electricray1981)
Member
Joined: 1 year ago
Posts: 119
Topic starter  

Just to give a small update regarding my project.

First sorry to be absent so long time but duty calls I had quite some work and was not able to make a interesting post here. But now I just would like to mention that my project is continuing but I am diving into ROS and see what that brings. I t is a bit hard to start but I think it is good to start learning this it has great posibilities

 

Grtz,
Ray


   
ReplyQuote
Page 2 / 2