OCS Pin Map


 

I plan to build a small observatory using a linear actuator. I'm still confused with the pin map on Oncue OCS. Do I need to use a router to control the observatory via wifi?


Howard Dutton
 

On Tue, Mar 24, 2020 at 03:36 AM, Hanif Nanda wrote:
I'm still confused with the pin map on Oncue OCS. Do I need to use a router to control the observatory via wifi?
The OCS uses Ethernet only a Mega2560 + W5100.  It's easy enough to add a wireless router to extend that onto WiFi.  It gets more complicated to join separate networks together (observatory + home) but that's possible too.  For this I used a pair of MikroTik wireless routers running in bridge mode... but be warned one might find them a bit daunting to setup.


 


I still don't understand the map pin for Si7021, BMP 180, MLX90614 and rain sensors. All I know is a pinmap for relay's.


Howard Dutton
 

These sensors connect to the OCS across I2C.  I2C is a bidirectional synchronous (has a clock signal) serial commutation protocol.  Requires two pins, one pin has the clock to coordinate the data movement and the other pin for data.  These pins are 20 (SDA) and 21 (SCL) on a Mega2560.  Both pins are pulled high by pull-up resistors, the Mega2560 has them built into the board design and they can't be disabled.  The pull-ups set the I2C bus voltage level and so the Mega2560 I2C is 5V.

There are 5V I2C devices.
There are 3.3V only I2C devices.
There are 3.3V I2C devices that are 5V tolerant (can do either.)
There are I2C compatible bi-directional level shifters that can convert the 5V I2C to 3.3V I2C.


 

Does this mean that the Si7021, BMP 180 and mlx 90614 sensors act as sleeves and must be connected together with pins 20 and 21 arduino mega? how about the rain drop sensor? I don't see SCL and SDA connections on the rain drop sensor


Howard Dutton
 

On Wed, Mar 25, 2020 at 09:11 PM, Hanif Nanda wrote:
Does this mean that the Si7021, BMP 180 and mlx 90614 sensors act as sleeves and must be connected together with pins 20 and 21 arduino mega?
https://learn.sparkfun.com/tutorials/i2c/all

how about the rain drop sensor? I don't see SCL and SDA connections on the rain drop sensor
It uses an analog input I believe.  I added support based on an earlier project I had working years ago but never implemented the hardware on my OCS.

Research, google is your friend, look at other Arduino projects.


Fernando Nino Sr
 

Howard it looks like the OCS sketch uses analog A2, correct.
This pic shows using a UNO but the wiring should be the same for the rain sensor with the exception on the pin, Use analog pin A2.


Fernando Nino Sr
 

Also here is a link from science.smith.edu that shows various sensors and how they work.

http://www.science.smith.edu/dftwiki/images/2/2e/ELEGOOMega2560Lessons.pdf


Fernando Nino Sr
 

I dont know if this could help you, I have not started on my sensor box yet, but plan to run cat5 wire to the box and use the option in this picture, as long as they are all 5v compatable, you should be ok, I believe if sensors are 3v then have to set up resistors. Put rain sensor on one side then the mlx90614(mounted onthe bottom) on the other side of the lid, I ordered all these sensors but the BME 280 covers most of the ex measurements.
I forgot where I pull this image from to give them credit. Sorry allergies are kicking my butt this time of year.

Above just an idea of how to set up the sensors.
Nino


Howard Dutton
 
Edited

On Fri, Mar 27, 2020 at 07:13 AM, Fernando Nino Sr wrote:
Howard it looks like the OCS sketch uses analog A2, correct.
This pic shows using a UNO but the wiring should be the same for the rain sensor with the exception on the pin, Use analog pin A2.
Yes that's the concept, there is NO requirement to use A2 simply change the example if you like.  This example uses a 0.0 to 1.0 range which corresponds to 0V to 5V.  So 0.25 is then <= 1.25V (for rain) and 0.75 is > 3.75V for dry.  You can see the voltage on the rain sensor output and adjust values (and its pot assuming it has one) to achieve the desired effect.

// -----------------------------------------------------------------------------------------------------------------
// gets rain sensor info. 1 is Rain, 2 is Warn, and 3 is Dry

#define WEATHER_RAIN_THRESHOLD_LOW 0.25
#define WEATHER_RAIN_THRESHOLD_HIGH 0.75

// return (invalid) if not implemented or if there's an error
int weatherRain() {
  // this is for the typical eBay rain sensor like this one:
  // http://www.ebay.com/itm/Raindrops-Detection-sensor-modue-rain-module-weather-module-Humidity-For-Arduino-/400439668701
 
  double rain = (double)analogRead(A2)/1023.0; // scale for 0.0 to 1.0 range
  rain = 0.1;
  if (rain <= WEATHER_RAIN_THRESHOLD_LOW) return 1; else
  if (rain > WEATHER_RAIN_THRESHOLD_HIGH) return 3; else return 2;
}

bool initRain() {
  return true;
}


Howard Dutton
 

On Fri, Mar 27, 2020 at 07:34 AM, Fernando Nino Sr wrote:
I dont know if this could help you, I have not started on my sensor box yet, but plan to run cat5 wire to the box and use the option in this picture, as long as they are all 5v compatable, you should be ok, I believe if sensors are 3v then have to set up resistors.
I don't know what you are saying here but if you mean a simple voltage divider to make 3.3V from 5V that may or may not work (depending on the current required.)  There are simple cheap to use linear voltage regulators that'll make a precise 3.3V from 5V if you need it.  They typically require two capacitors to function which is usually shown in the datasheet.

This is a separate issue from using the level shifter to convert the 5V CLK and DATA signals to 3.3V for I2C slaves that can't handle 5V.


ggedge1@...
 

Stupid question but where do you actually put the code for the rain sensor?


Howard Dutton
 

On Sun, Jun 28, 2020 at 04:41 AM, <ggedge1@...> wrote:
Stupid question but where do you actually put the code for the rain sensor?

A picture etc...


Fernando Nino Sr
 

Did you get your rain sensor code set up?