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
Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
We were thinking of setting up a greenhouse soon and my mind wandered to greenhouse automation. I have some experience with microcontrollers. I don't do embedded software for a living but I do a ton of assembler--mostly x86, but I've dealt with z80 briefly, HC12, and 68k. For any microcontroller with a limited number of registers I'd much prefer to code in a C since I am not fond of hand coding out all the juggling.

Some important things to worry about is watering, air temperature, plant temperature, humidity, and light. Beyond that I'd like some sensors to pick up on when things are wrong. For example, I'd like alarms if it thinks something failed. A water pressure sensor should be able to trigger something to notify me in some way if the watering system appears to be messed up. Ultimately I'd like to mess around with all facets so I need an appropriate amount of I/O ports to do the job. Chances are in all cases it will involve a device that's either on or off, so single I/O pins will probably do it. I can put together basic hardware to deal with that; it would probably just involve relays.

Where I need some help is in selecting a controller. I want something that is remotely accessible and can withstand humidity and potentially getting wet. I am close to just using an Atom-based system running off an SD-MMC card and hijacking a serial port to toggle pins. It looks like that would be about $200. There I could give it some really simple commands from time to time and it could do all the thinking and monitoring. Alternately I was thinking about microcontrollers with ethernet or USB ports that weren't smart at all but could handle commands to turn stuff on or off with something else remotely calling the shots. I wondered generally how robust these systems are and how easily it is to implement communications with them. I had some bad experiences recently trying to get a USB stack working on something that I'm inclined against using one; I'd love something that had enough support to do socket I/O with perhaps just the inclusion of some existing source.

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Zo posted:

You can get a development board with a nice microcontroller from a number of big name companies for cheap (like this is 75 bucks and is more powerful than anything you'll need), which would come with a programmer, power supply, and an easy to use board. No need to go "dumb" when ridiculously fast micros cost <10 bucks a piece nowadays.

Then if you want easy, reliable networking, I've used Xport's ethernet modules and they're incredibly braindead easy to set up. Basically connect to your micro's serial pins and power/ground (3.3V), and plug in an ethernet cable. It'll automatically get an IP from your network and you're good to go. The module is 50 bucks and will probably save you a lot of headache. It also has a small embedded web server so you can even just write up a webpage and view your greenhouse stats through a browser anywhere (disclaimer: I haven't used the embedded web server, I just used it as an ethernet -> serial bridge).

edit: these things will withstand standard industrial temperature range (-40 to 85) and for humidity there are a number of coating sprays you can purchase
At $125 I would have thought that fine a year ago, but having to work with Atom-based systems for about two years now and seeing what they can do, it looks like I can get one together with case and RAM for $200. And there I'd have most everything built in except for some pins to toggle relays. They don't need a fan to cool them--especially without the rigor I intend to apply. They'll go through a lot more power but they're much better than a regular PC chip. It could still be a stupid idea for reasons I wouldn't know though. Perhaps affixing the USB I/O would introduce weak points for moisture and heat. Or maybe I'd get stuck with reading sensors since it wouldn't have A/D converters.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I am wondering again about playing with a microcontroller that has Wifi capability (add-on or not) but is generally powerful enough to run Linux like a SBC. The reason being is that I would need something with a nice web UI, and I don't expect a smaller microcontroller with a built-in web server will be able to provide it. Nor would I want to be responsible for writing web server code to do that itself. So perhaps an SBC with Linux and Apache with some modules built in so I can create a web UI like I might expect to do on my PC. I was hoping for something with at least 8 A/D pins, "some" serial I/O pins with some doing PWM, and generally some of that I/O goodness that you'd expect from a microcontroller.

It looks like Atmel has some stuff--too much really. Between assessing the individual products and the kits I could then buy with them, I am overwhelmed. Does somebody have some general recommendation with which I can focus on this?

If this brings on any deja vu, I did bring this up many months ago but it languished for awhile.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

SnoPuppy posted:

I'd probably go with either a Beagle Board with a USB wifi controller or a GumStix module.

To do what you want (run linux, apache, use wifi), you will need to have something quite a bit more powerful than a simple micro.
If you don't really need linux, and just want a web server, I know there are some for the Arduino+ethernet. And at least one company makes a wifi module for arduino (http://asynclabs.com/)
I will look at that Beagle Board some more, but upon first impression of its specifications, it doesn't itself have do built-in serial I/O, or A/D converters--things like that. I think Gumstix' modules have some of that stuff, and I hadn't seen that until now. Thank you for that; I'll have to comb that more intensively.

I don't think the Arduino stuff is going to do it. I saw online at least one project where a web server was indeed running on an Arduino, but I was hoping to use an existing web framework as much as possible to serve the pages and give myself a decent UI. I can't imagine anything on the Arduino having that, nor would I expect anybody to reinvent that.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I figured this might be a good place to first ask about linear control system stuff since I imagine either somebody will answer or tell me a better thread or forum to put it. In college I did study control systems but the whole lot of the class was just grinding through it. The professor wasn't explaining anything and we all were hopelessly lost. It looks like he figured it out the year after us and subsequent students actually liked the stuff.

Fast forwarding almost a decade, I see a situation where I think I need a compensator for a thermal application. Device A is setting a temperature and Device B is measuring it. They both report back a temperature but Device B is located in the place where we really care about the temperature. So I am trying to find a good way to convey feedback to device A and adjust without a lot of oscillation. To make things even more interesting, at lower temperatures, there is an undershoot problem where device B never gets as cold as device A is set, so device A has to be dropping much lower. However, at high temperatures, the temperature set by A will closely match device B.

I thought I'd just whip out a PID. I used an algorithm online that would run on the PC controlling the devices. I sampled a step response at one particular temperature and used a Ziegler-Nichols tuning method to get a first impression of good PID gains. It seemed to work really well the first time. The problem was if I tried different temperatures with that PID, it failed miserably. I have thought maybe I'd collect step responses across the range of valid temperatures, calculate gains for each, and interpolate across them based on the desired temperature. I wondered if there was a better way.

I am hoping to find a compensator that can be aware of the undershoot problem at the low end and still lock on to a steady, correct temperature consistently. I assume a compensator of a higher order would be capable of something like that. I wondered if there was something where I didn't need to rely heavily on tuning gains. This is because years from now, a different sensor might be in place, but the general principle will be there. Namely, it will still be true that at the point of device B, there will be an undershoot in cold conditions. Is there something better I should try? If so, can somebody point to a good online resource to sort out how to implement it and tune it properly?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm responding to the most recent post though I read everybody's so far.

ANIME AKBAR posted:

when you say that your system behaves differently at different temperatures, do you mean different ambient temperatures or different setpoint temperatures?

also keep in mind that the transfer function from A to the temperature of B is not homogeneous, and therefore not strictly linear (since ambient temperature is above zero). What is linear is temperature rise above ambient vs input.

It responds differently to different set point temperatures. Generally the temperature device A sets is close to what B gets at high temperature. But at much lower temperatures, device B will read something not as low as what A is setting. The whole system is in an environment consistently expected to be at room temperature. The thermal control is a cooling application; the location at device B is more inclined to heat up than to cool off.

It would be fatal for the item being cooled if device A set too high a temperature, so it is clamped. There is also a specification range on device A keeping it from getting too cold. So there is indeed a clamping function that I had put in myself as protection on either case. And the integral term rammed right into it.

What I'm trying right now is something like an integral compensator in a first stage to try to expedite things, and then it moves on to a model based on a curve I fit to a function that tells me given desired B temperature, what to set for device A.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I had put a Jumperless bread board as a stretch comedy option on my Christmas list and . . . was gifted one, so that's pushed forward some greenhouse automation stuff I have wanted to do for some time. I have a few generations of Raspberry Pi's and have done some I/O with them before. I was figuring I could use one of my idle ones to practice, and then order a Pi Zero when I was ready to go. Some things I would want to control:

1. Various relays to toggle things on and off that would be powered externally.
2. Air temperature sensors. I can assume some inside a humid greenhouse and some outside for ambient temperature. I suspect of the things I have to look up and get that this will be the easiest to figure out.
3. Soil moisture sensor. I have seen a few things for this and have even seen projects were people just kind of make one. I don't know much about them at all and if they're any good. I think they all have to be calibrated and some corrode.
4. Controlling for irrigation. So a valve and preferably something that can measure water flow or water pressure to verify this. I don't know what's suitable for, say, 40 psi out of a garden hose or whatever.

Some other aspects of this:
1. I am intending to communicate with it via WiFi.
2. I'm thinking I'd ultimately run a web interface for it on some external hosting.
3. I'm thinking of using it as a science project for Rust. I have done a little bit of Rust for work, but that stuff has been a bit goofy since I've had to use Rust 2018 and a bunch of unsafe C code.
4. I don't want to assume I have regular wall power for this and might need to do something with batteries and solar charging, but I don't really know how much it matters. I'd at least want battery-backed power.
5. I think it'd have to be water resistant and particularly protected against humidity.

I assumed I'd just use something in the Raspberry Pi universe that wasn't a pico for this and treat it like a small-scale Linux machine, but I could consider other options including something more like a regular controller if I can still do WiFi, configure it, and have it work with an external web site or something.

Edit: I'd have done more homework on this and not just taken it to the thread if I had known I'd be getting some new toys, so apologies for having to humor me.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Splode posted:

I made a soil moisture sensor that's been running in my yard for a little over a year now. For various reasons I ended up using a custom designed circuit board, but I used a capacitive approach and it is still working.

https://core-electronics.com.au/capacitive-soil-moisture-sensor-v20.html

Don't use this supplier, you can get them from ebay/AliExpress/any good local electronics hobby shop - but this will work, long term. The resistance ones corrode fast and are useless.

I used an esp32 and a custom PCB for the electrode, and leveraged the esp32's capacitive touch feature for mine (I copied this approach from some random project I found online) - but I used this module to verify mine was working ok and to be honest never quite got results as good.

Are you basically shoving a circuit board into dirt? I figured it would need some covering or something--or at least the exposed circuitry would be covered. I figured I would have seen one picture of one them mummifying the IC-end with hot glue or something, but they're all just naked.

quote:

As for irrigation - I bought an off the shelf solenoid valve explicitly for irrigation and made another esp32 device that uses a relay to control power to the solenoid. Solenoid takes 24VAC power and I made sure to get a normally closed valve in case it fails, so it doesn't fail and dump water. I'd still be very careful about your code when working on this. The solenoid valve, hose adaptors, etc were all from my local hardware store (Bunnings - equivalent of the US' home depot).

I don't know why I'm surprised these are common enough for the big box stores because there are irrigation systems everywhere, but I was expecting to have to find this on Adafruit or something for some reason.

By any chance, do you have any impressions of what it would be like to write Rust code targeting esp32 devices?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I got an irrigation valve from Home Depot the other day and have finally gotten a 24V supply I wanted to use with it. I decided to test it out. I can't connect it to any plumbing yet, so I figured I'd just check the solenoid. I get a constant buzzing when I power it instead of anything like a single click. The resistance is a consistent 47 ohms and it doesn't drift around. The manufacturer's site states the resistance should be 38 ohms. I popped it off and don't see anything move when I power it. I'm not sure if I'm supposed to on one of these types of solenoids or not. I think the magnet is contained within some stuff within the inlet.

I wouldn't be surprised if the first one I bought was garbage because my most recent home improvement store runs have been pretty disappointing like that, but I was hoping somebody had something to say about that and if it's conclusively good or bad.

I think it's this model:
https://www.homedepot.com/p/Rain-Bi...wE&gclsrc=aw.ds

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I can't look right now, but I bet I got a DC supply instead of AC since that is the kind of thing I'd do despite checking multiple times.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I confirmed 24 VAC supply and 24 VAC solenoid. I guess I did have a moment to check.

babyeatingpsychopath posted:

Shoulda just got the rainbird transformer that was one bin over.

The Christmas elves hosed with the inventory of all the Lowes and Home Depots here. I suppose since I wound up stopping at multiple places, I could have, but I was starting to rage when I couldn't find a 20A GFCI, a standard-sized decora cover, white spray primer, and white spray paint all in one store. So I had consigned that one to Amazon.

The supply is 730mA and the starting current is something like 450mA so I should be able to clear it. Well, now we assume the supply I got isn't AliXpress butt stuff.

Edit: I do think I botched the relays though. 24V DC. I think that matters with solid state ones.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Noo I don't even have the relay involved yet. I just connected the solenoid to the 24VAC power supply to test if it opened or not. I was curious if somehow that in itself would be stupid with these.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I just order a shitpile of specific grab bags from Jameco, along with an ESP32 and a small text display. I haven't really been able to get into anything because anything interesting always assumes you're a kleptomaniac with this-or-that spare just laying around. I know that's how it goes and that's even how it was with college projects, so I'm just supplementing the bits I already have with whatever-what-the-heck.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm trying to remember a best practice from two decades back when I was doing digital systems stuff in college. It had to do with powering LEDs from TTL chips. If I remember right, we were discouraged from trying to power our LEDs from TTL outputs directly and instead use an inverter. We would tie a resistor in series with the LED from Vcc into the output. When the inverter was low, it would suck in the current to drive the LED. I believe the idea was buffers and inverters both were more robust with the current they could pull but this could damage the regular logic chips. Furthermore, inverters were preferred because they'd drive the LED as you'd expect from the original digital output; A high signal coming into the inverter would become a low signal, but that would sink current and cause the light to turn on).

I kind of suspect that I could get LEDs these days that have very low current requirements so this practice is less important, but when I was trying to search for it, I was seeing a lot of transistors driving an LED instead.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Okay, I can see why my Google searching on trying to shove a resistor in series with an LED into an inverter isn't coming up with much. That time's gone on. I don't know about 74xx generational changes and it'll be pretty wild what I see when a sack of them show up for me late in the week. I'm just starting to stock myself up on stuff in any capacity that I could consider for a hobby.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
My piles of poo poo (along with an esp32 and a display) from Jameco showed up:



(I already had a pile of resistors, capacitors, wires, and some cables, so I didn't order a bunch of those)

The programmable IC's:



I was kind of figuring there'd be an obvious z80 but I don't think there was one at all. I got a few BIOS chips for 486s though! I'm a bit surprised by the FPGAs.

The LED display bag came with some goofy rear end display board that they've apparently been dumping on people for a decade now. It's some proprietary fan board controller but people who are particularly motivated can yank it off the control board get themselves a tactile display.

Now I still won't have anything I actually need, but a lot of stuff that's close enough to just hack and stab my way through half of it.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I think I need to ask how I should start storing all that random stuff I got. It's all mostly still just bagged up. I need to get some stuff to cushion all those pins on the ICs and just bins and bins and bins.

It'll all probably just live in a giant box at least until I move across the country some day

kid sinister posted:

There's no such thing as too many of those.

True, but comparatively, I had zero of everything else so they were really pulling ahead.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
SMD's good to bring up because I did get a baggy of random-rear end SMD crap. I figured a pound of that or whatever would go a loooooong way.

...then I found a lot of it was in a bunch of strips and containers that probably heavily bump their weight.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm trying to figure out how I might most concisely connect a Raspberry Pi (or this ESP32 kit board I got) to a Jumperless breadboard. It has a header on the top that will work with Arduinos like, say, the Arduino Nano ESP32. I'd like to take advantage of that for other boards without having another breadboard just kind of plugging into it to the side. That kind of defeats the purpose. What's some stuff I could generally look into for some kind of adapter or DIY? The most I've really ever played with are double-sided PCBs. I'm trying to figure out if this is an excuse to design my own.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Does somebody have a recommended method for homebrew PCB's or should I just get them fab'd?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm pretty amazed by that. I never did my own PCB and my memories of it go back to classmates doing senior projects in college something like 20 years ago. So I figured I was going to have a miniature meth lab going on to prototype some stuff.

I'm just making a board to reroute pins for the Jumperless breadboard and various microcontrollers and microprocessor projects I have here like an ESP32 board I want to use, some older and newer Raspberry Pis, and some other things. So I was assuming I'd need a 2-layer just for worming stuff around. Now I get screw around in KiCAD for the first time.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm trying to sort out typical ESP32 pinouts. I think this Whadda board is following fairly typical ESP32 pinouts:

https://cdn.velleman.eu/downloads/25/prototyping/manual_wpb109.pdf

But holy JPEG artifacting, Batman! It's gross to see it on there. Something I'm trying to figure out is if some pins are set aside for flash memory and can't be normally used. I've seen this come up before. I've also seen those pins come up for UART.

Look at this image for an example showing them that way:
https://www.teachmemicro.com/wp-content/uploads/2023/12/ESP32-pinout-diagram.jpg

What confuses me is that I usually see UART1 pins all in that area, (RX1, TX1, CTS1, RTS1). However, I'll see RTS2 and CTS2 taken over as well, which just seems kind of strange. Also, UART0's CTS and RTS pins compete with VSPI ports. Yes, I know these ESP32 ports are very flexible but I was trying to keep stuff together that's labelled together.

Edit: Do these ESP32 pins that are set aside mix a bunch of SPI and UART stuff together? I guess I see SPI roles for those pins too.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Does your buddy also understand the capacitors used with those transformers?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

kid sinister posted:

Now if only capacitors were that reliable... You young kids should be glad we don't use paper wax caps anymore. They're sticky and gross!

Isn't there a kind of generational variation in the quality of capacitors? I remember it being a common enough this in the very late 90's into the early 2000's to have to resolder all the caps on a motherboard because they'd all swell and burst. That apparently resolved itself at some point?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm surprised cars aren't just constantly frying themselves.

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is there some way to look up multiple parts at once? I have these piles of chips from grab bags and I want to cut down on all the turnaround on looking them up.

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