RRCI Roof Controller
Hey all, I need help. I am using this, https://projecthub.arduino.cc/cfar/rolling-roof-computer-interface-rrci-a7f9ac, controller to open and close the roll off roof of my observatory. My coding is almost identical. I would like to add a rain sensor to it to close the roof when it rains. How hard will this be, and can someone help me with this? This, https://a.co/d/0am5DvJ, is the sensor I am going to be installing.
Arduino Project Hub
undefined
52 Replies
Just the coding. I used ChatGPT for the first time, ever, last night to see if it could do the coding. I have very little faith in it. I can send my original code and what ChatGPT produced.
im sure someone has prolly told you this before but please dont use chatgpt to code if you can avoid it. chatgpt isnt rlly the best coder and if you dont u derstabd how the code works you wldnt be able to debug.
Thats why I posted both, I have no faith in Chatgpt. I posted it for comparison only. I would prefer if someone here can look at the code I am using and add what I need to have it work correctly.
Can no one help with this?
just saw this, sounds like an interesting project.
without first digging into a couple of kb of code, you want to open and close the roof based on time, serial input, and a rain sensor?
The way it works now is the software, N.I.N.A. sends the command to open and close the roof when I desire, that works fine. I just want to add a rain sensor to close the roof when it starts to rain.
Thank you, by the way.
ok, adding <fill in your sensor here> is in and of itself trivial.
that particular sensor might be fun at a science fair but I wouldn't trust expensive equipment to it π
from a logic perspective it's just adding "if x, y, or z OR it's raining" close the roof.
you probably want a fuller picture of the environment, like if dew point > X close the roof
which wouldn't trip that sensor (it might have to be raining pretty good to trip it)
Would adjusting the pot to a lower value trip it quicker?
those sensors are little better than cutting a zigzag in a sheet of aluminum foil, played with those as a kid in the 70's
lol
you want to close the roof before actual raindrops fall I'm guessing
this is an observatory?
Yes, it is.
I do have an star count if statement in my sequence for imaging, so ideally, the roof will close when clouds roll in. But I have been cought twice so far where it didn't kick in in time.
ok, i didn't analyze the code yet.
having "there are no stars anymore" as a parameter is nice.
I suppose it could happen that it can rain sideways such that it is still clear where you are looking
Exactly.
so the goal is as automated as possible, maximum observing time, but do save the equipment
Also, I am only about 2 miles from the coast, so cloud, fog, rain or snow can come without any warning at all.
Yes. That is the goal.
challenging conditions on a good day
I came here a few years ago in the middle of winter when the forecast was supposed to be clear. Walked into the observatory, got everything set up, rolled the roof of and it was snowing. Closed everything up, put everything away, walked out of the obs and there ws 6 inches of snow on the ground.
"Everybody talks about the weather, but nobody does anything about it" - Charles Dudley Warner in 1897
Well I'm trying to avoid it.
the code you have is decent, but lacks the "rain sensor"?
Yes.
adding the OR condition to the "close the roof function" isn't hard, but getting the right sensor will be the trick
I did find a video on youtube that offered this code to add to my code, but I have no idea where to put it all.
#define BUZZER_PIN 3
void setup()
{
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
if (sensorValue < 1000)
{
analogWrite(BUZZER_PIN, 50);
}
else
{
analogWrite(BUZZER_PIN, 0);
} delay(1000); } I'm guessing the BUZZER_PIN would go to my relay that actually opens and closes the roof.
} delay(1000); } I'm guessing the BUZZER_PIN would go to my relay that actually opens and closes the roof.
yes, your code would continuously monitor the "rain sensor".
IF sensor says "it's raining" THEN close the roof. again, the basic logic is not a big deal, getting good sensor readings will be.
that snippet above is the basic idea, you could substitute the roof relay for buzzer
the tricky part is
i've seen kids use those sensors for science fair projects where a clothesline is reeled in if it rains
Yeah, I've watched those videos.
if your t shirt gets a little damp π€·ββοΈ
dew point is easily obtainable from a low cost sensor, i don't know offhand if that is a good proxy for "it's going to rain soon"
Dew point would not be a good measure as I can get heavy dew and not get any rain.
but still be able to observe?
Yes, I have dew heaters on the lenses of my scopes.
i just did a quick Google, looks like most folks use a human as a rain detector π
lol
One thing that just hit me is that if the rain sensor shuts the roof and my if statement ends the sequence, in my end sequence statement, there is also a close roof command. Is there a way to have the rain statement void the later close roof statement?
i'd have to look but in general yes, the code can be written to cover any possible combination of events.
It's something I may have to play with in the software to figure out.
"If it is raining" would be a high level thing that overrides any combination of other inputs i would imagine.
you might want to open in daytime (for solar observation say) overriding the timer, but you'd never want to open if it's raining
Here are the settings I can play with to see if I can get things to work the way I want.

ok, so "SkyRoof" has inputs for all those various readings? and you are looking to add "Moisture detected"?
Yes.
I can also work with one of the contributors to N.I.N.A. to develop a plugin, if needed, to read the rain sensor in NINA.
For now, I just want the arduino to read it and close the roof.
take a look at this tutorial (these folks are better than most)
https://lastminuteengineers.com/rain-sensor-arduino-tutorial/
run some experiments with the sensor in a stand alone mode, see if perhaps it would be good enough.
note the suggestion to only power the sensor while you are taking a reading, these types of sensors corrode pretty quickly when just sitting out in the world.
Well, that's the thing. It will not be exposed to weather when the roof is closed. I will put it close to one of the scopes, so when the roof closed, it will be out of the weather. I do have a sky cam to see the sky before I set things in motion to image.
if it is wet and current is applied it will corrode
anyway, just a quick stand alone test should inform whether such a sensor is at all suitable
So their code is just to test the sensor?
if you know a contributor to NINA they must have some idea of what folks use to achieve this
yes, very simple "it's raining" or "it isn't"
OK, so if it decides it "Is Raining", what coding will need to be added to trip the relay to close the roof.
i'm looking at your code now, give me a few minutes
Most just use the If StarCount statement.
Np, take your time.
looks like the logic is there
Ok, I will give that code a try on the weekend. I have bad weather until then. Thank you so much for your help, I really do appreciate it.
no problem, you want to hook the sensor's AO pin to the
RAIN_SENSOR_PIN (A0)Will do, again, thank you.
turn DEBUG on so you can monitor the values you get under various conditions
looks like that is the default