Automating a Mushroom Growing House - while collaborating with a local High School and teaching students some real world skills

Mushroom House Controller – Part 1

A Collaboration with Maesai Prasisart School, Maesai, Chiang Rai, Thailand

A short while ago, the local high school in my area and myself decided to collaborate on a real-world project regarding an IoT device. The device (prototype above) will be used as a controller in an Oyster Mushroom growing house, which in turn will be managed by the members of a local disabled persons association. This is very exciting for a few reasons…

I will get the opportunity to teach interested students how to solve real-world problems using electronics, as well we will do something for the community and thus contribute to making the lives of the local disabled people a bit easier.

In the long term, the data collected by the device can be used to teach other mushroom growers in the area about the optimum environment to help them ensure that they get the perfect harvest every time…

In this post, I will thus do things a little differently from my normal setup, and focus more on the collaboration, as well as teaching moments. I shall also include quite a lot of pictures. The usual schematics and PCB descriptions shall still be available, but only on the PCBWay Shared projects page ( link to be added in due course)

The initial idea is to produce two different PCB’s with basically the same function, for the time being designed by myself. One, used in this post, will be a 3.3v version, with battery backup, and the other will be a 5v version, with level converters ( I could not resist the potential teaching opportunity that these provided) and no battery backup. The 5v version, which I shall introduce in part 2 will be assembled by the students, while I shall assemble the 3.3v version.

Further to that, the goal is to break the PCB up into logical modules and teach the students about each module. Their task would be to then design a PCB of that module, and in the end, combine all the modules into a functional project.
As a further part to this, a special interest group shall then make use of the knowledge learnt during the development of the modules to design a third PCB including all of those modules, as well as any other that they find may be needed, assemble it and use it in the real world.

Gallery – At the remote site

Over here, Grade 12 students assist in the construction of a mushroom house.
The pictures do not need a lot of captions, as they are quite self-explanatory

The next day, in the classroom

We started with a prototype on a breadboard, with some basic firmware. This was followed by a simple PCB design (with frequent 3D views so that the students could see what was happening)

This was followed by a practical session where the students had the opportunity to try their hand at designing a part of the PCB. It is quite important that we understand that this is the very very first time in their lives that they were ever exposed to this. They were all extremely excited and some grasped the concepts quite fast, while others took a more cautious approach…

Manufacturing the PCB

Now it was up to me to finalise the initial design and get it manufactured.

The PCB for this project was sponsored by PCBWay .

Disclaimer:
Clicking on the PCBWay link will take you to the PCBWay website. It will enable you to get a $5.00 USD voucher towards your first PCB order. (Only if you sign up for a free account).

Conclusion – Part 1

The assembly of the first board was done by myself, and firmware development was started. Stay tuned for Part 2 where the students will get the opportunity to assemble a SMD PCB for the very first time in their lives…



4 Likes

Nice project …
I would recommend covering the top and bottom and strain-relieving the mains input.
Touching this connection or having the wire pull from those screw terminals could be dangerous.

image

Hi Don,

Yes, that will be done, I have removed the acrylic covers for better pictures. It will definitely have strain relief on the mains cable as well, as well as be housed in a lockable IP-65 enclosure to keep the water and insects out :slight_smile:

I would suggest this protection any time power is applied to the board including testing.

This looks fantastic, great thing to be involved in.

Based on a few years using a DHT-11 sensor with a ATtiny to control the ventilator fan on my boat I think you may run into trouble with this part…

After exposure to prolonged high humidity they can saturate, even when the humidity falls they continue to return high readings. Running the fan even once the boat dried out.

My solution is to swap out the sensors, I’d bought a five-pack, so I keep ‘spares’ in a jar with some silica sachets and swap every few months in the winter. Letting them fully dry out ‘de-saturates’ them.

DHT-22’s are a drop-in replacement, and supposed to be more stable. If you free up another I/o line you can use I2C sensors like the BME280 and Co., which are still still affordable, and more suitable for ‘production’ setups.

1 Like

agreed :slight_smile: pictures use battery power, but anything involving mains needs all of that, no argument there. :slight_smile:

Hi Owen,

Yes, I am concerned about the DHT-11 as well… I did however have to work with what they had available… i2c is available, so BME280 or similar will definitely be a way way better long term solution… It is important to note that they have really no real clue what they need, but still managed to define a spec of things that :must be used :frowning: I will see how it goes, but as far as I am concerned, that DHT-11 must go as soon as possible and be replaced by something more stable and reliable… It is good as a teaching sensor, to get the concept across, but anything after that, they need something better - so agreed on that as well

1 Like

Thankyou Jean,
As a learning exercise starting simple so you can build on that makes sense; this is why my boat thingie ended up with one too :wink:

The other thing I learned is that these sensors (and the BME280’s etc) tend to produce occasional nonsensical readings. I’m not sure if this is hardware or timings going wrong in code…

  • This is fixable in code; on the boat I take readings every 20s, keep the last six readings, and the value returned is the result of excluding the highest and lowest of them, then averaging the remaining four.
  • Coding this up was a fun exercise, something for the software side of the lessons maybe?
  • It sounds simple, and there are lots of algorithms that will work, but doing it efficiently was somewhat challenging. The ATtiny is badly ram limited and a big non static array of floats really killed it, but only after 3 mins or so of operation. And this how I learned all about float vs. UINT_8, static variables and stacks… After I learned how to debug on the ATtiny using a single serial out…
1 Like

Hi Owen,

Yes, that is all quite interesting. The averaging trick will be useful. I have seen those nonsensical readings before… I would love to find out where they come from, or at least why the sensor seems to misbehave…

My usual thing to do with other sensors is to have a revolving buffer of let’s say 10 readings, which is averaged out, these are then sent to another buffer and averaged etc … This came from working in the telemetry field for a while and having to " dampen" certain sensors in software since the hardware cold not be slowed down…

I really like your 6 sample idea… definitely gets rid of big spikes and dips…

As far as extending this to a teaching idea, it is also great… now, I am no teacher, and the students and the school are well aware of that fact :slight_smile: The situation is however very unfair to the students… They have zero experience but really want to learn… Faculty decide what hardware they will use, and then it is basically up to them from there …

Then, I entered the picture, let’s say by chance since we did not plan this, but all parties were very happy to accommodate each other, especially myself, since I have wanted to do something like this, give back to the community and teach new “initiates in the dark arts of electronics” for quite a while…

They currently do not know much about anything… some have a bit of Arduino experience, and some have touched some bread-boarding before…

I see this as a very perfect opportunity to teach them from the beginning - the only spanner in that works is that they are already in their final year, and this is their final semester as well :slight_smile:

It does leave a whole new group for next year, or hopefully, we can arrange to step back one more year, for them to get 2 years of experience…

As far as that ATTiny goes, my hat goes off to you if you managed to get something extremely useful into one of those… I have played with them before as well, and yes, the RAM constraints are quite a thing… They are however super fun to play with ( especially the newer ones, ATTiny1616-SF jumps to mind here…) These are UPDI programmed parts, and I had to figure out what that means, where to get a programmer etc… eventually ended up building a programmer myself, which was a very interesting learning experience in itself.

They are definitely useful in their own right, and as most projects never use all of the GPO pins anyway, using one of these instead of let us say a 328P does make sense :slight_smile: Cost is also a great factor

1 Like

I2C has a tendency to do that. It is great for on-board communication. I use twisted pairs with shielded-grounded insulation. And then the voltage drop can cause stray readings.

In my next revision I think about doing it more “properly” amd whatever sensor I decide to use, to get it on its own little remote PCB, with a suitable MCU, and use CAN-Bus to send the data back to the controller… That should be more stable over longer distances, as well as allow me to keep the I2C stuff as short as possible, and on the PCB …

2 Likes

Maybe consider the R pi pico-w. They are cheap. they are able to be put into sleep mode. they can operate an HTU21 sensor. and they have a small footprint

I am well familiar with the RP Pico, original and the w variant… and yes, they are all you say :slight_smile: Unfortunately, the locals have still to really “discover” them and thus ESP type chips are a “forced” requirement on most projects…

I am however using a Pi Pico ( Cytron’s Maker Pi 2040 dev board ) as a teaching platform for coding, and the students are already well familiar with that… so, in the near future, it will definitely be possible to make a switch over to one of the original or W variants for a project :slight_smile: