Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
kid sinister
Nov 16, 2002

LimaBiker posted:

Smell? Quite hard.

Actual temperature? Much easier with an infrared thermometer pointed at the spot where the engine will most likely be. Thermal imaging if you wanna be real fancy.

Seconding infrared. You might want to point it at the back of the cars to pick up the tailpipes.

Adbot
ADBOT LOVES YOU

ryanrs
Jul 12, 2011

So it's not even a running engine, just the smell of hot metal and grease and such? Detecting that by smell is a science project that is much more involved than running a wire, imo.

Skinnymansbeerbelly
Apr 1, 2010

Shame Boy posted:

You'd need to know what kind of vapors that smell is made of first, but there's plenty of sensors that can detect basic molecules like CO concentration or volatile organic compounds or something like that that might work :shrug:

Yeah I already tried with an SGP-41, it was a complete failure :v:

Also, is there an underlying reason that the narrow FoV IR thermometers are so loving expensive? Even one dimensional ones are $40

Splode
Jun 18, 2013

put some clothes on you little freak

Shame Boy posted:

You'd need to know what kind of vapors that smell is made of first, but there's plenty of sensors that can detect basic molecules like CO concentration or volatile organic compounds or something like that that might work :shrug:

Or just like, sense the car using an electric eye sensor or whatever and then start a timer to run for an hour.

Yeah surely the easiest way is to just detect the car itself. When the car arrives, start a timer and turn it off after that.

To detect a car you could use a distance sensor of any kind (IR reflective, IR beam break, ultrasonic, you name it), or something in the car (eg some kind of transponder, or an RFID tag - you can get systems that operate at a reasonable distance).

You could also detect the state of the garage door using a similarly wide number of options.

You could even detect yourself! Something like when your mobile joins the wifi, kick on the purifier for X time. This only works if you're only leaving via the car and only people who's phones you can ID are using the garage.

All of those are going to be way cheaper, more reliable, and ultimately simpler than trying to detect exhaust gasses. However, gas detection is dope so if you want to do it that way because it's cool then more power to you, and please continue posting about the project as it's a fun one!

Cojawfee
May 31, 2006
I think the US is dumb for not using Celsius

Skinnymansbeerbelly posted:

Yeah I already tried with an SGP-41, it was a complete failure :v:

Also, is there an underlying reason that the narrow FoV IR thermometers are so loving expensive? Even one dimensional ones are $40

The IR gun thermometers on amazon have gotten pretty cheap, one there is as low as 9 bucks. You might be able to break one of those open and hijack what it is doing.

ryanrs
Jul 12, 2011



Poop Alarm is starting to take form.

I'm going with a PLC-like design, because I've always wanted to build an electrical control panel with DIN rail and terminal blocks and relays.

Raspberry Pi Zero 2 W to run the show.
12V 3A step-down for beepers and misc HMI devices.
5V 5A step-down for the Pi Zero a power-hungry USB peripheral.
4x PLC-style digital inputs.
7x low-side outputs, 500 mA/ch. Good for driving relay coils.
4-channel leak sensor (simplified design from previous post).
RF module, receiver for keyfob remote.

There's a lot more I/O than I need. But I figure once I have a controller in the garage, I'll find other things for it to do.

Control engineers: Do PLCs count their inputs and outputs starting from 0 or 1? I feel like I've seen both, and I'm wondering if one convention is dominant, or if it's just random based on manufacturer and history.

ryanrs
Jul 12, 2011

Poop Alarm?
Sewer Sentry?
Brown Alert?

kid sinister
Nov 16, 2002

ryanrs posted:

Poop Alarm?
Sewer Sentry?
Brown Alert?

Number 2.0

Stack Machine
Mar 6, 2016

I can see through time!
Fun Shoe
Stool Tool

kid sinister
Nov 16, 2002
Potty Spotter

csammis
Aug 26, 2003

Mental Institution
Brown-out Detector

hark
May 10, 2023

I'm sleep
Might work better with an arduduino

some kinda jackal
Feb 25, 2003

 
 
espp32

ryanrs
Jul 12, 2011



Changes:

I put the Raspberry Pi Zero on the wrong side of the board. It needs to be aligned with the right edge so that the microSD slot is accessible on the left side. This board will be mounted on a DIN rail, so there will likely be tall modules on both sides blocking access. Only the top and bottom edges are open.

The Pi Zero will be plugged in face-down, because that's how the standard GPIO header is placed. Pi HATs are supposed to be small and mounted on top of the Pi. But upside-down mounting should be fine. The USB and HDMI ports will still be visible, because they stick out a little beyond the edge of the Pi. But the microSD slot will be completely hidden, and it'll probably be annoying trying to insert the card. So I drew a little picture to help you find the slot.

Moving the Pi to the right side evicted the RF module. I'll hand-solder it to the back of the pcb, which is probably a quieter location for it anyway.

Renumbered the I/O starting from zero. It really does seem to vary by PLC brand.

Replaced the 500 mA darlington low-side driver with discrete SOT-23 MOSFETs. Turns out that chip's 500 mA rating was largely aspirational. It could probably drive my seven 24V industrial relays just fine, esp at room temperature. But if you tried to drive several 12V automotive relays, it could overheat. I felt it was under-powered for what should be a bank of general-purpose outputs.


I replaced it with a 74HCT244 to boost my 3.3V logic to 5V gate drive for a bunch of 0.12 ohm MOSFETs. Low Rdson means you never have to give a poo poo about coil current or duty cycle.

e: Am I supposed to fuse these outputs? I don't think a polyswitch is fast enough to save a SOT-23. I see electricians talking about fusing PLC outputs, implying that the PLCs don't have internal protection, maybe.

OTOH, with 7 outputs, I can tolerate some attrition. Ablative circuit protection lmao.

e2: I think a 1.25 A polyswitch should melt before this 0.036 ohm MOSFET. I think that combo should be able to short out a big 24V supply and live to switch again (maybe). Probably worth the extra $3 for reliability in the face of wiring mistakes.

ryanrs fucked around with this message at 06:01 on Mar 28, 2024

ryanrs
Jul 12, 2011

How does grounding work in electrical control panels? Is the negative 24V rail explicitly connected to the chassis/safety ground?

For example, this industrial 24V supply does not connect OUT- to chassis ground. Contrast this with PC power supplies, which do connect the negative terminal to chassis ground.

My pcb will be mounted on a metal plate with standoffs. The plate will be connected to safety ground via contact with the DIN rail. I may or may not also add a grounding stud to the metal plate.

My plan until now has been to keep safety ground separate from my pcb negative rail/ground plane. (I know my screenshots show plated mounting holes, but I've been planning to change them to NPTH.) The was no reason for my board to tie the negative rail to chassis ground, even though I didn't expect any significant voltage offsets.


But now I realize I have two U.FL coax connectors that I was hoping to connect to SMA bulkhead connectors on the metal enclosure. Antennas work better on the outside. So I guess the the negative rail does need to be connected to chassis ground? Hmm.

BattleMaster
Aug 14, 2000

You're supposed to connect either the positive or negative to the system's common/ground rail. Which one you select determines the polarity of the output (I bet you knew this already but I wanted to just state it for other people). I was also under the impression that you normally connect the common/ground rail to the chassis/safety ground unless you have a good reason not to and you observe some safety guidelines.

For instance, in something I built for my research, a PMT-based counting system, I needed +/- 24 V. I bought two identical supplies and used one for positive and one for negative.

CERN's guidelines for power supply grounds say if you need to avoid ground loops or otherwise isolate things electrically, it's okay not to connect common to the safety ground if the voltage is less than 50V. In my system I followed those guidelines and connected the chassis that the modules were in to the mains ground but I left the low voltage output floating to avoid a ground loop. The system's common was connected to safety ground elsewhere through the high voltage supply, so if I didn't do this I'd have made a big ground loop.

If ground loops are not an issue I personally don't see why you would have the low voltage section floating though. I'm interested to hear more from you or others why that might be a decision because there's probably something I've missed.

ryanrs posted:

But now I realize I have two U.FL coax connectors that I was hoping to connect to SMA bulkhead connectors on the metal enclosure. Antennas work better on the outside. So I guess the the negative rail does need to be connected to chassis ground? Hmm.

If you really need to avoid this, some coaxial connectors are available in isolated versions that insulate the connector from the chassis and provide a separate connection for the shield. I don't know how well that works for RF or anything like that but it's an option if you really need that. Maybe you can print or machine or purchase insulators that can add isolation for standard connectors.

I used isolated BNC connectors in my project to avoid ground loops for some external connections as well.

BattleMaster fucked around with this message at 22:47 on Mar 28, 2024

ryanrs
Jul 12, 2011

Isolated antenna options: plastic radome with isolated antenna element. Pretty sure the metal bushing is isolated from the antenna element. Here's another with a plastic bushing.


Having done some more reading re. panel grounding, I think I definitely want to tie -24V to chassis ground next to the power supply. But I might not join them on my pcb, and just keep the antenna isolated. And I guess I should switch to a 3-terminal power connector (24V, 0V, GND) like I see on PLCs.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.
I experienced an interesting bug this morning while messing around with a dual core STM32H745 microcontroller.

It has a set of peripherals called hardware semaphores that are used to coordinate use of shared resources between the processors. I'll skip the details of how they work unless someone cares, the important thing for now is that the hardware semaphores can have their state changed by simply *reading* from particular memory addresses.

It turns out that pointing your hardware debugger at one of those special memory addresses counts as reading it and changes the state of the semaphore, causing things to behave in unexpected ways that depend on exactly which semaphore you're trying to look at in that moment. Also, if you don't set a hardware breakpoint the debugger doesn't do any reads, so if you just run your program it works one way but if you pause it and step through line-by-line it does something totally different. Finally, if a particular semaphore is not shown in the active part of your debugger window on your PC screen it does not get read, but if you scroll the window down to where it gets shown then it begins getting read and changes state!

Pretty much a perfect Heisenbug.

ryanrs
Jul 12, 2011

when the capacitance of your debugger breakpoint is damping the race condition

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.
I've had that experience with a few peripherals, including an ethernet controller from what I recall. Since the hardware debugger just accesses the memory bus the same way the CPU would, of course it'll trigger shenanigans. The good ones warn you about this in the manual...which means I think I've seen it once, ever, actually warned in advance.

For a long time the whole idea has been frowned upon due to C/C++ compilers being kind of happy to fiddle around with reads/etc. so even when you intended to read it you can get weird bugs.

ryanrs
Jul 12, 2011



PCB Status: Swimming in discretes.


Final bits of functionality added:

1. 3 LEDs + 2 buttons. Not sure what they'll be used for, but I feel like this thing should have buttons and LEDs.

2. Magnetic beeper. Better frequency response than a piezo beeper. Can produce passable ST:TNG computer noises.

3. Qwiic I2C connectors so I can plug in sensors from Adafruit, Sparkfun, etc.

4. Temperature sensor. Measures the pcb / enclosure temp.

5. VL53L4CD laser time-of-flight sensor. Cheaper than putting a plunger switch on the enclosure door, and saves an input channel.

ryanrs
Jul 12, 2011

Grounding Chat



I've been looking at this Click Plus PLC wrt grounding. Mostly because high res pics and specs were easy to find.

Observations:

1. Exposed metal on antenna and USB jack. These must be attached to chassis ground, per UL 508.

2. The negative supply rail is isolated from the chassis ground, 1000VAC dielectric test.

To do this, I imagine they use a 24V input, isolated dc-dc switcher. Prob something like this.

Adding an isolated supply to my board would be straight forward, but I'm not going to do it. It seems extremely unnecessary when I'm bonding the negative rail to safety ground anyway. I think I understand why industry does it that way, but for a one-off personal project, it seems like an OK corner to cut. Just don't integrate the poo poo Alarm into a positive ground installation (looking at you, telecom).

Foxfire_
Nov 8, 2010

Are there ESD protection protection parts for each pin on the bottom not shown here?

BattleMaster
Aug 14, 2000

ryanrs posted:

Adding an isolated supply to my board would be straight forward, but I'm not going to do it. It seems extremely unnecessary when I'm bonding the negative rail to safety ground anyway. I think I understand why industry does it that way, but for a one-off personal project, it seems like an OK corner to cut. Just don't integrate the poo poo Alarm into a positive ground installation (looking at you, telecom).

So I am curious, what's the reason in industry for not connecting the chassis to the 0V/common rail?

In my project it was unavoidable to connect them because I was using PMT bases with integrated preamps, so there was no possible way to isolate the 1200V PMT supply from the low voltages used to power the preamp and pulse processing electronics. And there was no way I was going to not have the safety ground hooked up to the HV supply.

However, in the power supply enclosure, I had 3 power supply modules wired with floating outputs. The chassis was grounded for safety, but the outputs were not referenced to it so that I wouldn't create a ground loop, since the system would be grounded via the power supply enclosure and the HV supply.

So now I'm wondering, if the HV supply wasn't a thing what the benefits of not connecting my electronics to the chassis would have been.

Maimgara
May 2, 2007
Chlorine for the Gene-pool.

ryanrs posted:

Grounding Chat



I've been looking at this Click Plus PLC wrt grounding. Mostly because high res pics and specs were easy to find.

Observations:

1. Exposed metal on antenna and USB jack. These must be attached to chassis ground, per UL 508.

2. The negative supply rail is isolated from the chassis ground, 1000VAC dielectric test.

To do this, I imagine they use a 24V input, isolated dc-dc switcher. Prob something like this.

Adding an isolated supply to my board would be straight forward, but I'm not going to do it. It seems extremely unnecessary when I'm bonding the negative rail to safety ground anyway. I think I understand why industry does it that way, but for a one-off personal project, it seems like an OK corner to cut. Just don't integrate the poo poo Alarm into a positive ground installation (looking at you, telecom).
Most PLCs are signifiantly less fancy than using isolated switchers - the front power suipply connector has 3 pins - positive, negative and PE. The chassis and metal parts are grounded via the PE connection, which the panel builder is responsible for providing a suitable ground to. In nearly all electrical cabinets, the 24V negative is grounded, so on the PLC negative and PE is effectively the same potential. For the dielectric test, the positive and negative are tired together and tested with reference to ground.

ryanrs
Jul 12, 2011

Foxfire_ posted:

Are there ESD protection protection parts for each pin on the bottom not shown here?

An excellent question. No, there are not. All ESD protection is on the top side of the pcb.



There are some polyswitch self-resetting fuses on the back.


The leak detector lines have 10nF caps to eat ESD.


The 4 input channels are ESD safe (anti-parallel LEDs in the optoisolator).


The 7 outputs have a TVS for positive spikes (inductive kick from turning off relay coils). Negative spikes will conduct to ground through the output N-ch MOSFET body diode.


e: Now you have me thinking about adding ESD diodes to the I2C connectors. None of the little dev boards I've seen use them, though. I could put a diode steering array next to the connector to send ESD into a nearby decoupling cap.

ryanrs fucked around with this message at 02:15 on Mar 30, 2024

ryanrs
Jul 12, 2011

BattleMaster posted:

So I am curious, what's the reason in industry for not connecting the chassis to the 0V/common rail?

Industry does connect 0V to chassis ground most of the time. But not inside the PLC. The electrician ties them together inside the cabinet (in normal practice).

I do not/was not planning to float my 24V supply. This whole side-quest was about figuring out why commercial PLCs have galvanic isolation between power and chassis ground. It sounds like it is useful if you are wiring up -48V telecom stuff, or some sprawling industrial plant.


Maimgara posted:

Most PLCs are signifiantly less fancy than using isolated switchers - the front power suipply connector has 3 pins - positive, negative and PE. The chassis and metal parts are grounded via the PE connection, which the panel builder is responsible for providing a suitable ground to. In nearly all electrical cabinets, the 24V negative is grounded, so on the PLC negative and PE is effectively the same potential. For the dielectric test, the positive and negative are tired together and tested with reference to ground.

Not just the exposed metal parts, but we can also assume that the internal MCU supply rails on the logic board are also referenced to earth ground, not the 0V input.

You could make a PLC with the internal supplies referenced to 0V, if constructed like a double-insulated appliance. But that's not possible with exposed USB and antenna connectors. So the isolation has to be in the PLC's internal power supply, an isolated supply.

ryanrs
Jul 12, 2011



Flexible sensor grid. It will be wrapped on the bottom of the pipe and secured with zip ties. I'm still thinking about how I'm going to attach wires to it. Solder + blob of adhesive for strain relief?

The scalloped edges catch bits of poo poo and paper, encouraging the sewage to flow over the surface of the sensor.

Cory Parsnipson
Nov 15, 2015

ryanrs posted:



Flexible sensor grid. It will be wrapped on the bottom of the pipe and secured with zip ties. I'm still thinking about how I'm going to attach wires to it. Solder + blob of adhesive for strain relief?

The scalloped edges catch bits of poo poo and paper, encouraging the sewage to flow over the surface of the sensor.

Epoxy or a blob of superglue would probably work fine, unless you're talking about a PVC pipe. If you can 3d print something, maybe make a pipe collar thingy with some indentations to protect the solder points?

ryanrs
Jul 12, 2011

The pipe is 4" OD cast iron, with many layers of paint. 5" OD at the joints.

The sensor sheet is 4x6", which is probably a bit larger than it needs to be. JLC says it'll cost $55 for 5 boards, but I expect they will hit me with an extra gold charge on top of that (fair).


e: Trying out variants of the unit cell. Beware of accidental swastikas, which have the same diagonal symmetry.

ryanrs fucked around with this message at 22:52 on Mar 30, 2024

ryanrs
Jul 12, 2011

kid sinister
Nov 16, 2002
You really are #1 in the #2 business.

some kinda jackal
Feb 25, 2003

 
 
Hey I have a battery question.

If I have the specs of a battery (3.7vdc, 850mah/3.15wh, lipo), is that enough information to determine battery compatibility?

Have a device on which the battery is on its way out. 30 min or less of charge. It's soldered to the board but really easy to replace so I'm not actually worried about the physical act of replacing it..

Batteries which are marketed as "for" this device have a lead time of 2+ weeks to deliver off amazon or ebay, but I can get a different battery with compatible dimensions and SEEMINGLY compatible specs (3.7vdc, 900mah, lipo) for a competing device overnighted. Is there anything I need to consider before just giving it a shot? Like both batteries look fairly simple with just a red/black lead to attach to their respective devices, so I don't think there's any device specific electronics in play.

In my mind this should be a simple swap, but as with everything in this space I'm very wary of nuance that I don't really understand.

For reference here is the actual battery:

https://www.amazon.ca/dp/B0B1TPTFG7

and just as I'm typing this I noticed the replacement candidate doesn't actually fit dimensionally for height (8mm vs 6mm, let's assume that's not going to fit) but let's just pretend I did find a dimensionally compatible battery for my own curiosity.

some kinda jackal fucked around with this message at 11:54 on Apr 2, 2024

ryanrs
Jul 12, 2011

If they're both silver-bag style and rated 3.7V, then I think you're ok to substitute. Look for similar mAh capacity, say +/- 25%. (If the new battery is substantially less mAh, then the original charger might charge too fast for it.)

And as you fuss around with wire clippers and a soldering iron, be aware that the new battery is live and charged, so don't short it out.

Shame Boy
Mar 2, 2010

ryanrs posted:

And as you fuss around with wire clippers and a soldering iron, be aware that the new battery is live and charged, so don't short it out.

Working with lithium-ion battery leads always feels like I'm defusing a bomb and if I cut the wrong wire (or I guess, accidentally cut two wires at once) it's going to blow up in my face. I should probably wear safety goggles while doing it now that I'm thinking about it...

some kinda jackal
Feb 25, 2003

 
 
Oh yeah, that's absolutely on my radar, thank you. Whatever I source I'm going to try to add a tiny connector on both ends so I don't have cables flopping all over the place.

ryanrs
Jul 12, 2011

Shame Boy posted:

Working with lithium-ion battery leads always feels like I'm defusing a bomb

Tech industry makes good on yet another sci-fi trope, high fives all around!

Naturally, the invention of exploding power cells has brought with it certain risks, but such is the price of progress. NiCds really sucked.

AlternateNu
May 5, 2005

ドーナツダメ!

ryanrs posted:

Tech industry makes good on yet another sci-fi trope, high fives all around!

Naturally, the invention of exploding power cells has brought with it certain risks, but such is the price of progress. NiCds really sucked.

I was doing tech work out in Luzon, Philippines field testing some off-the-shelf equipment DoD was looking to maybe buy for use on FOBs. This included a lightweight, foldable photovoltaic panel set up with a modular LED lamp for nighttime illumination. Batteries and governor were stuffed in a pelican case with a simple connector to the PV cell and the lamp. Set it up midday recording charge/discharge rates and local temps.

Came back the next morning and the light wasn't on. The Marines at the FOB tell me they heard a large pop the previous night. Open the pelican case to a giant plume of black smoke. The batteries straight up exploded. I look at the contractor who designed/build the drat thing and ask him what kind of batteries he used.

NiMH. For use in 100+ degree desert environments. >_>

TwoDice
Feb 11, 2005
Not one, two.
Grimey Drawer
Does anyone have a recommendation for a cheap but decent oscilloscope?

Adbot
ADBOT LOVES YOU

kid sinister
Nov 16, 2002

TwoDice posted:

Does anyone have a recommendation for a cheap but decent oscilloscope?

Define "cheap". How much are you looking to spend?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply