Workshop blast gate...
 
Notifications
Clear all

Workshop blast gate automation

85 Posts
6 Users
47 Reactions
3,679 Views
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander Thanks.

I'm okay with the speed, but a little faster would be better. I'm sure there will be a number of things to fine tune once the gates are installed.

I was looking at the limit switches being the same function as the push button switches. i.e. just a switch on a port. 

Would you suggest having spark suppression on the buttons as well?

I wondered if the switches might need debounce. Is spark suppression the hardware equivalent of software debounce?

Could you explain a little further?

 

This post was modified 7 months ago by AndyD

Well, that could’ve gone better 😬


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8046
 

@andydowns Two separate issues. ALL switches need debounce, it can be hardware or software. Spark suppression in a potentially explosive environment is hardware only. Use any of the dozens of debounce libraries for software debounce, but I think in your case hardware debounce might be a safer solution.

The reason I said it was because the limit switches are close to the air dust mixture. I don't know where any other buttons are.

Background.

ANY air/fine particle (sawdust, flour, corn) mix creates static charges by friction (particles rubbing together) IF you add a spark to that, the odds of an explosion increase dramatically. If the system is WELL grounded then you might not have a problem, but using special linit switches for dusty environments will help. Maybe waterproof switches but marine gear is always crazy expensive. Instead of limit switches, consider Hall effect, or even the old magnet and glass reed switch. Encase the glass reed switch in a thin resin wrapper or similar to prevent breakage. Lot's of ways of doing that, the modern rare earth magnets work over a very long range. Add a todo item at +5 yrs to examine the rare earth magnets for breakdown (they eventually crumble) and replace if needed.

My brother blew up his >$100k shop due to failing to follow sound engineering practices. The first thing he bought with the insurance settlement was a proper professional materials handler otherwise known as a dust collector.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8046
 

@andydowns I just realized there is an even simpler and safe solution. Add a small time delay to the blower motor startup and any limit switch operating. As long as both conditions are not present, your risk is what you previously said you were comfortable with.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander Hall effect sensors sound good, I'll take a look.

I was going to use optical limit switches, but the mechanics are more complicated. Maybe I'll revisit that.

Well, that could’ve gone better 😬


   
Ron reacted
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander

Posted by: @zander

@andydowns I just realized there is an even simpler and safe solution. Add a small time delay to the blower motor startup and any limit switch operating. As long as both conditions are not present, your risk is what you previously said you were comfortable with.

Although the speed is okay as is, I think adding more delay would become irritating. Better than an explosion, but irritating.

 

 

 

Well, that could’ve gone better 😬


   
Ron reacted
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander

Posted by: @zander

ANY air/fine particle (sawdust, flour, corn) mix creates static charges by friction (particles rubbing together) IF you add a spark to that, the odds of an explosion increase dramatically. If the system is WELL grounded then you might not have a problem, but using special linit switches for dusty environments will help.

 

There is a point at which the energy in a spark isn't sufficient to act as a source of ignition. It depends what the atmosphere consists of. i.e. Intrinsic safety.

Of course to do it "properly" I would have to consider other things such as, what the potential temperatures of components are in fault conditions.

None of the parts I am using are suitable for hazardous areas and if the dust escapes into the workshop then the whole area becomes a hazardous area. It's a real minefield. 

I will take what precautions I can, but at some point I will make a judgement call and run with it.

 

Well, that could’ve gone better 😬


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8046
 

@andydowns No problems, but your first statement is 100% incorrect. There will always be a point at which an arbitrarily minute spark is enough to push the charge over the edge. Obviously the smaller that spark the smaller the risk. My brother only lost his shop and a fortune in wood and machines plus a new pair of hearing aids because the shop was a separate building. Had it been attached to the house things could have been a lot worse. Fortunately his insurance paid for total replacement other than the wood and as a woodworker you know how much that can hurt. I had in my shop genuine Brazilian rosewood. I was offered $4,000 a board for a few boards but did not have the required paper work to allow me to sell it. I bought it legally, but the guy who sold it to me did not (tradesman 5 finger discount)

Sorry, I need to keep the record clear for future readers. I do not have much concern for what you are planning. You have got good instincts and have received good advice, your risk is extremely low, just not zero. BTW neither was mine and I was an industrial electrician before I got into computers. My brother had a defective switch (lights) and his shop was always full of airborne dust so it was a perfect storm.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
AndyD reacted
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander 

My workshop atmosphere is generally very good; I continually monitor it.

These readings are a little higher than normal because of the work I have been doing and the fact the extraction gate is missing from my bandsaw at the moment. The gate is the one I've removed for the project experimentation.

Air quality

I also have an air cleaner which I use when the atmosphere feels dusty or the monitor shows it is dusty.

Air cleaner

So the workshop atmosphere is never likely to be explosive. The atmosphere inside the ducting is of course a different matter.

Since the switches are outside the ducting and in the workshop, it reduces the risk. In addition, the switches will only activate (potentially spark) when the atmosphere in the pipes is very low dust. i.e. before the machine starts producing dust.

As you say, there is a risk and always needs to be considered, but the risk is small.

Well, that could’ve gone better 😬


   
Ron reacted
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander

Posted by: @zander

@andydowns No problems, but your first statement is 100% incorrect.

I'm not an expert in this field, but am pretty confident I am correct.

There are different methods of safely using electronics in hazardous areas. One of those is called intrinsic safety. The way is works is to limit the amount of energy available to the device in the hazardous area. If the energy is below the threshold for that environment no explosion will happen. This is true for any explosive environment but has to be correctly assessed. The assessment is tricky and should definitely not be attempted unless qualified to do so.

When I started at the last company I worked for, they did an experiment in a classroom that demonstrated the principle perfectly. They had a glass vessel, about 10 litres capacity and filled it with an explosive mixture of H2 and air. They placed a tin foil lid on it to slow the escape of the gas. H2 is lighter than air.

In the bottom of the vessel was a sparking device. They applied a voltage by pressing a momentary switch on the desk which applied enough voltage to create a spark. There was a large flash and a bang and the tin foil flew into the air. The demonstrator caught it before it landed on the floor.

The explanation was that there are three things are needed for ignition. Fuel, oxygen (oxidiser) and a source of ignition.

He then setup the experiment again with the same mixture of gas but this time connected the sparker through an isolation barrier. The barrier restricts the amount of energy to the sparker. There was enough voltage to cause a spark but this time there was no ignition. A very impressive demonstration.

 

This video only tells a small part of the story but describes the basics.

 

There are also other methods on for making electronics safe in a hazardous area.

Using non-sparking equipment, such as switches. They tend to be very expensive.

Using an explosion proof enclosure. If the electronics need more energy than barriers can supply, then they are housed in an Exd enclosure. This prevents an explosion from escaping to ignite the surrounding area.

The subject is complicated and huge and as I said, I am no expert on the matter, but these are the general principles.

 

 

This post was modified 7 months ago by AndyD

Well, that could’ve gone better 😬


   
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

Today's question is about powering the circuit from a power supply rather than usb.

Electronics is my weakest area so just to check I have the following correct:

Circuit power

  
Is this the right way of powering the circuit up? i.e. 12V 5A PSU for the motor and the step down regulator. The step down supplying 5V to the ESP32 (I also need 5V for other parts of the circuit yet to be added). Supply the A4988 vdd with 3.3V from the ESP32 to match the ESP's logic level requirements?

Can use any or all of the ESP32-DevKitC gnd pins because they are connected together on the module? i.e. is multiple gnd pins for tracking convenience?

When I come to do the pcb layout, would it be better to place the 100uf C1 cap next to the A4988 or the incoming power socket?

Does the ESP32 need a decoupling capacitor?

Should I ground any of the unused pins?

Any other beginner mistakes?

 

Well, that could’ve gone better 😬


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8046
 

@andydowns What happens if the stepper keeps running because the limit switch got broken. Also, should both limits be normally open?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@zander

The motor is pulsed in a while loop until either a limit switch is closed or the loop counter reaches expected pulses + 50. If the loop counter expires then the assumption is that the gate has become jammed or a switch is broken. I.e. the motor will skip.

I’m not sure how well I’ve explained that. 😊 I'll share the code tomorrow when my pc is back on.

The open limit switch will be closed when the gate is open and the close limit switch will be open. And visa versa when the gate is closed.

Well, that could’ve gone better 😬


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8046
 

@andydowns Ok, sounds good.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
AndyD reacted
ReplyQuote
(@davee)
Member
Joined: 4 years ago
Posts: 1924
 

Hi @andydowns,

As you are probably aware, there are lots of ways someone can mistakenly add in problems when building a circuit, and even engineers who 'should know better' have to rethink and fix oversights from time to time, so it is impossible to spot all of them via a forum, but here are a few comments for a start.

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

RE: Supply the A4988 vdd with 3.3V from the ESP32 to match the ESP's logic level requirements?

Certainly. the logic supply (Vdd) to the A4988 should be 3.3V to match the ESP32.

The data sheet for the A4988 from https://www.pololu.com/file/0J450/A4988.pdf includes:

image

suggesting the A4988 current demand is unlikely to exceed 8mA.

The ESP32 boards commonly available are sold at low prices, and hence it is not surprising that the onboard regulator is usually rather small, and poorly heat-sinked, when just considering the ESP32 load, so in general, you should not draw a 'significant' current for other boards, but a current of say less than 10mA for a single board should not be a problem. So I would start with trying that - it will probably be fine.

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

RE: Can use any or all of the ESP32-DevKitC gnd pins because they are connected together on the module? i.e. is multiple gnd pins for tracking convenience?

A comprehensive answer to this question would involve analysing the ESP32 board layout, etc. but a good PCB layout would provide one or more earth pins close to each of the inputs or outputs, so that they can be used as 'matched pair'. This is not just convenient, but the current flow from an input or output pin must return through a 'ground' path, and the best principle is to keep the 'active' and corresponding 'ground' paths together. 

The above description, is essential in cases involving high frequencies ... e.g. a TV aerial lead uses a co-ax cable, with the inner core being the 'active' conductor and the shield is the ground return.

For lower frequencies, it is possible to be more flexible, and hence there will only be few ground pins on the ESP32 board to choose from, but it is still a good idea to find the 'nearest' ground pin to the 'active pin'. Also, try to find different ground pins to pair with each power (input or output), and further different ones for GPIOs. With the GPIOs, try to group them according to destination and usage. e.g. the 5 control lines to the A4988 might share one ground line.

When I say 'good idea', I am implying that this is not always possible, so you may need to accept compromises, but I hope this description is a bit of guide to aim for.

In reality, digital logic electronics are usually very robust, and allow you to break (or at least bend) many rules, so don't get too concerned, just do your best, cross your fingers, and see what happens.

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

RE: When I come to do the pcb layout, would it be better to place the 100uf C1 cap next to the A4988 or the incoming power socket?

Again, there are no 'one fits all' answers, but capacitors used for decoupling, which includes C1, should be as close as possible to the load ... in this case the A4988 chip, with leads as short as possible.

-----------

From memory, the Pololu website suggests a particular minimum capacitor requirement, which is related to absorbing the voltage spikes when the current to the motor coils is switched. Sorry, I don't recall the exact details, but hopefully you can find it, as they obviously have first-hand experience of this particular case, which is much more demanding than most circuits.

-------

Simplistically, the capacitor is acting as a small 'tank' or 'reservoir' of electrical charge, that can supply short term, high current demand spikes by the A4988. If you imagine the charge was water, then clearly a nearby tank connected by short pipes would be much more responsive to a sudden demand, than a tank connected by a long thin pipe.

There may be other places that would benefit from having their own capacitors as well. The most obvious is the 12V to 5V regulator. I didn't spot a specification of what you had in mind, so it is hard to give a specific answer. If it is a linear chip regulator, then check the manufacturer's data sheet for recommendations, but a capacitor at the input and another at the output is commonly suggested. Again, these should be close as possible to the chip.

If it is a small switch-mode board product, then in an ideal world, I would refer you to the designer's notes. But if it is small board from AliExpress, Amazon, etc., with little or no documentation, then at both the input and the output, I would suggest a pair of capacitors in parallel ... say 100uF electrolytic and 0.1uF ceramic.

----------

Please bear in mind that decoupling capacitors are a bit like insurance policies. Many can be omitted or badly wired in, and the circuit will still work fine. But occasionally, something 'unexpected' will happen, and not having a paid up policy will prove to be a frustrating mistake.  Reliable electronic circuits tend to have 'unnecessary' extra capacitors ... cases of too much decoupling capacitance are technically feasible, but very rarely experienced.

Hence, I think you can guess my answer to "Does the ESP32 need a decoupling capacitor?" 

   i.e. Fit one, or better still another 0.1uF + 100uF pair I suggested above.

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

Re: Should I ground any of the unused pins?

By 'unused pins', I presume you are thinking about ESP32 GPIO pins.

I'll broaden my answer to say it applies to all logic circuit input pins. For example, I would also check that all of the A4988 input pins are connected in some way. In any logic circuit, an unconnected input pin is a hazard waiting to turn into a problem. Typically, hazards include high current spikes from the surrounding circuitry, inducing a voltage on the unsuspecting input pin.

In more detail, GPIO pins can be configured for several different capabilities, and this includes those that are not actually connected to anything. So one approach is to use the microcontroller software to configure all unused pins to a 'safe' state. Of course, this means the microcontroller must run its boot programme long enough to set the pin (at each boot up), before the input pin has been challenged with a spike. Not usually an issue, but not good design practice.

Also, should you accidentally forget to configure a pin, or incorrectly configure it, then it may not be obvious, and could be a very tricky problem to track down.

---------

So personally, I would suggest tying each unused input to either ground or Vcc, via its own resistor of about 10kOhm. This might seem like a bit of unnecessary work and parts, but if it is via a resistor then:

  1. Should a software error result in it becoming an output, then even if the output is set to high and the resistor is connected to ground, (or vice versa), then the resulting current will be negligible and safe.
  2. Should you find you need an extra GPIO at any time, it is easy to remove the resistor, leaving a convenient soldering point.

Of course, this is just a suggestion - feel free to adjust to your preference.

------

I note your A4988 part of circuit shows reset pin connected to sleep pin. That does not look right! They are both inputs, needing specific attention, such as pull-ups (only first thought - a capacitor to hold reset low whilst power supply settles at power up might also be useful for reset - I haven't read the data sheet, so there may be further information there.). It might be useful to be able to drive reset (and possibly sleep) by ESP32 GPIO pins ... I haven't thought this through, so it is just a suggestion to consider.

-------

I would advise having debounce on all 'mechanical' input switches, regardless of whether they are limit or push button. This means adding a capacitor in parallel with the switch contacts. The value of the capacitor depends upon the 'bounce' time and also how long you want the switch to appear 'closed' when it is 'pressed' momentarily. This is one of those cases that some experiments with different values is a good idea, before committing to a design.

In addition, I would swap the positions of the switch and its resistor, so that the resistor connects to the 3.3V rail and the switch to ground. (Obviously, you also need to swap the software to match.) The reason being that some or all switches will probably be on flying leads, etc., and may accidentally touch grounded metal under fault conditions. If the flying lead is directly connected to 3.3V, it will short out the voltage regulator output, whilst if it is a via a resistor, the current flow will be minimal .. say 0.3mA, if resistor is 10k.

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

I am sure that is more than enough sermon for now. I hope it is clear, useful and not too scary. Please feel free to question anything you disagree with or find hard to understand. Bear in mind, some of it is 'opinion', rather than absolute fact, simply because there are so many 'it depends ...", factors that can only be guessed at from afar.

Best wishes and good luck, Dave


   
AndyD reacted
ReplyQuote
AndyD
(@andydowns)
Member
Joined: 8 months ago
Posts: 79
Topic starter  

@DaveE

Once again your response has a nice balance between detail and not too much bamboozlement. Thank you.

I'm going to break further questions down into separate replies. I hope that's okay. I asked more questions than I realised. 😊

Posted by: @davee

Certainly. the logic supply (Vdd) to the A4988 should be 3.3V to match the ESP32.

The data sheet for the A4988 from https://www.pololu.com/file/0J450/A4988.pdf includes:

-- attachment is not available --

suggesting the A4988 current demand is unlikely to exceed 8mA.

The ESP32 boards commonly available are sold at low prices, and hence it is not surprising that the onboard regulator is usually rather small, and poorly heat-sinked, when just considering the ESP32 load, so in general, you should not draw a 'significant' current for other boards, but a current of say less than 10mA for a single board should not be a problem. So I would start with trying that - it will probably be fine.

 

One thing that is becoming clear is that the datasheets are generally for the chip itself and what I am going to be using for the most part are a third party boards with the chips on them. I notice on the datasheet that there is a scattering of other components around the device which are probably/hopefully included on the board, but you would have to reverse engineer it to be sure.

With that in mind, what you say about not relying on power from yet another 3rd party board (ESP32 dev board), unless it is minimal makes a lot of sense. I'll keep this in mind and lookup how the modules can be connected together correctly. 

I do remember the electronic engineers I used to work with talking about power budgets, I guess this sort of detail was included in them.

 

 

Well, that could’ve gone better 😬


   
ReplyQuote
Page 2 / 6