JLCPCB Prototype for $2(Any Color): https://jlcpcb.com
Software for the mouldy shed project has progressed (but still fits on one page). Packet data with temperature and humidity is sent by the transmitter to the receiver. Touch sensor data (to control a ventilation fan) is sent back the other way.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

14 thoughts on “It works! arduino, transceiver, oled, touch sensor and relay”
  1. Avataaar/Circle Created with python_avatars DAVID GREGORY KERR says:

    What having Slim-Jim antennas at both ends to increase the transmission reception distance.

  2. Avataaar/Circle Created with python_avatars Ted McFadden says:

    You might get a bit more real-time "feedback" on whether the fan is running by either delaying the toggling of the LED, or the display of your "Fan On" indicator, until the Ack payload is sent. Even if the acknowledgement isn't received the first time around (irony!), your "receiver" will at least keep trying to turn on the fan.

  3. Avataaar/Circle Created with python_avatars Cattflap says:

    Made this project myself this weekend, works a treat … so many possibilities for this , thanks for the video 🙂

  4. Avataaar/Circle Created with python_avatars wolph says:

    A quick suggestion, try using PlatformIO with either Visual Studio Code or Atom as an editor so you have autocompletion available as well. No need to remember all of the functions that way 🙂
    It's not perfect but it's a whole lot better than the Arduino editor.

  5. Avataaar/Circle Created with python_avatars FD1 says:

    Think I'd reduce a lot of the hardware and use a couple of ESP8266's with something like Espeasy or Tasmota – all for under a tenner. You will still have all the 2-way comms and be able to connect the usual sensors. Good idea on using current draw to check fan but you're stuffed if it's stuck. Shame the fan doesn't have a spin pulse output you could monitor – couple of magnets (for balance) and a hall effect sensor like the NS005 A3144 board?

  6. Avataaar/Circle Created with python_avatars Marco Costa says:

    My 2c. If you send the actual state of the relay together with the measurements, you can use the momentary mode of the switch. This way, you will not turn off the fan at startup of the receiver. I don't know if you always want the fan to be off at startup of the switch side.

  7. Avataaar/Circle Created with python_avatars Anders Jackson says:

    You should not do this, as it makes the code more complicated.

    But you can use the value of an assignment. So.

    writeDigital(2, (payload[0]=! readDigital(3)));

    So, assignments do gave a value in C and C++.

  8. Avataaar/Circle Created with python_avatars John Rasmussen says:

    And now you´ve got 3 logic inversions going on! The first is in the touch sensor, where you set it to active low. The second is in the receiver, where you inverted the input to turn on the LED. And the theird is now at the transmitter, to get the relay to follow the LED on the receiver….. Wouldn´t it be easier to just make the sensor active high?????

  9. Avataaar/Circle Created with python_avatars pvc says:

    Using arrays of type bool is really bad idea. And using its sizeof is even worse. The problem is that size of bool is compiler dependent and can be really anything. Plus it is minimum of one byte in size. And what compiler does when using array of bool values is not completely predictable. Even the same compiler can pack it differently with different optimizations enabled. There are few more complication, but explaining them would make this comment 5 pages long.
    Long story short: It's much safer to just define your payload as uint8_t and modify its bits using bitwise operations.

  10. Avataaar/Circle Created with python_avatars Hola! Maico says:

    yay it werks 😉

  11. Avataaar/Circle Created with python_avatars bytespider says:

    You should probably send the state of the fan relay back to the receiver so that the receiver can display the correct state after power loss

  12. Avataaar/Circle Created with python_avatars Michael Moore says:

    Don't forget to initialize the payload data value in the transmitter!
    Also – (and this is a bit of OCD on my part), in the receiver code, the first time the loop executes, it sends the fan state boolean BEFORE it reads the switch input. Move the switch read to the start of the loop – just for me.
    Cheers,

  13. Avataaar/Circle Created with python_avatars dentakuweb says:

    Is that the kind of relay that only needs power to switch (latching) or does it always need to be powered to stay on?
    The latter would probably drain the battery a bit faster.

  14. Avataaar/Circle Created with python_avatars Tom George says:

    Great video Julian, I think you should stop calling them tx and rx, they are transceivers.
    I notice you don't embed your code filename in your code.
    I do this;

    Serial.begin(115200);
    Serial.println("=== filename ===");

    in the setup part of the code.
    This way the code identifies itself when ever your connect USB plug.
    It is also good for keeping track of version numbers of your code as you develop it.
    Is there a reason you do not have a OLED on the shed unit?
    When you are down in the shed you will have a local readout of the conditions you are working in.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.