Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Weather Station Ideas


Gina

Recommended Posts

20 hours ago, Gina said:

Been checking out the Gray code wheel and positions of the optical sensors and I'm not sure I've got it right so I'm checking in more detail.

In your print design, you forgot the red section

... of your earlier colour chart.

Edited by wimvb
Link to comment
Share on other sites

18 hours ago, Gina said:

I think I have this worked out now.  An interrupted beam produces a low level output and a logic 0.

  • S1 on the inner ring along the N line. 
  • S2 also on the inner ring along the W line. 
  • S3 on the middle ring along the S line. 
  • S4 on the outer ring along the E line.

1557024680_Screenshotfrom2020-08-0716-18-59.png.5002e889f55f93c055e138d61cd57e4e.png

SSE and N have the same code. As do SE and NNE. Again, there’s symmetry along the vertical line.

This is your previous design, but inside out. You need to add a ridge going from the 12 o’clock position to the 6 o’clock one. In your latest design nearest the centre.

Edited by wimvb
Link to comment
Share on other sites

44 minutes ago, wimvb said:

In your print design, you forgot the red section

... of your earlier colour chart.

The red section is the same as the black section but turned 90°, so a sensor situated 90° round from the first on the same ridge will do the same as the red section but using the black section.  This "ruse" saves a section and makes for a more compact design.

Having the 4 sensors spaced round the circle at positions N, W, S, E makes it more difficult to work out but again makes for a more compact design than having sensors in a line and spaced far enough apart to include the whole width rather than the width of the emitter casing.

Edited by Gina
  • Like 1
Link to comment
Share on other sites

So, in your colour coded image, in stead of having 4 sensor in a row, inside to outside, you have those rotated 90 degrees. This means that the coresponding colour sections have to be rotated with them, to preserve the coding. Then, as you say, red and black will coincide, green needs to be rotated 180 degrees, which leaves it the same. Blue needs to be rotated 270 degrees, which also leaves it the same. Am I correct in this?

Link to comment
Share on other sites

I currently have 4 optical sensors which have 3.1mm slots.  The test PLA sheet I used was 1.5mm thick and with the curvature of the inner ring the tolerances are pretty tight so I've ordered some with a 4.1mm slot (5 so I have a spare - I have no spare with my current set).

Link to comment
Share on other sites

So far I've been using the ESP32 to read and send data to the browser (and still have more to do in that line) but now I also want to send commands to the ESP and use it for control as well as sensing.

Link to comment
Share on other sites

In all fairness, if you want to go this route with two way tcp/ip communication, you might want to look into MQTT as an alternative, unless you already have php and mysql running.

@jiberjaber and @tekkydave suggested this a while ago. As I mentioned before, I played some with MQTT, and found it quite straightforward to set up.

  • Thanks 1
Link to comment
Share on other sites

I think my web hosting supplies php and mysql but I have more to sort out before I get to that stage.  I shall probably look into MQTT in due course.  It's beginning to sound like a simpler solution 🤣

Edited by Gina
  • Like 1
Link to comment
Share on other sites

I have pretty much decided to go with MQTT for weather station and obsy roof control (and who knows what else).  I like the modular approach yet encompassing everything.  Seems RPi broker, several ESP32 and ESP6822 clients and client on my Linux Mint box producing graphs and charts.  Could add a wall display client too.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Working on the wind sensor connections to the ESP32 module.

The Hall sensor in the anemometer is connected to D4 on the ESP32 and the optical sensors to D34, D35, D32 and D33 in sequence.  This is the order of pins on the ESP32 module.  The collectors of the phototransistors are commoned and taken to 3.3v.  The emitters are connected to the ADC pins just mentioned with resistors to Gnd.  The IR emitter diodes are connected in series and connected between Gnd and 5v via a resistor to limit the current.  I have yet to perform tests to find the values for these resistors.  Once I've done this I'll draw and post a circuit diagram.

Link to comment
Share on other sites

Circuit diagram for the connections to the ESP32 for the wind sensors.  On the left are 4 optical sensors that read the direction from the encoder in the vane unit and on the right the Hall effect sensor in the anemometer that counts the revolutions to give wind speed.

1453509793_VaneSensors1.thumb.png.0d82eeb771777d0d7a06ef33186d947b.png

Link to comment
Share on other sites

I checked the volt drop on the LEDs at the current of 5mA that I'm using and they are 1.20v.  The supply will be around 6v.  Vin for the ESP32 is quoted as 5-12v though lower voltages mean less power on the voltage regulator.  This is not necessarily "carved in stone" I could wire the LEDs is pairs and use 2 resistors.

  • Like 1
Link to comment
Share on other sites

Testing shows 6mA diode current with 6v supply.  At that the the ON voltage across a 2K2 resistor is just below the Vcc and the OFF (interrupted light beam) is 0.5v.  So a threshold of 1.5v (half scale) should be fine.  To check all the optical sensors I think I'll write a sketch to read the value of each sensor and display the voltages (ADC readings).

 

Link to comment
Share on other sites

Test satisfactory 🙂

Added this code to the wind sensor ESP32 sketch.

const int An1 = 34;
const int An2 = 35;
const int An3 = 32;
const int An4 = 33;
int dir1 = 0;
int dir2 = 0;
int dir3 = 0;
int dir4 = 0;

And in void loop()

  dir1 = analogRead(An1);
  dir2 = analogRead(An2);
  dir3 = analogRead(An3);
  dir4 = analogRead(An4);
  Serial.print(dir1);
  Serial.print("  ");
  Serial.print(dir2);
  Serial.print("  ");
  Serial.print(dir3);
  Serial.print("  ");
  Serial.print(dir4);
  Serial.println("  ");

The readings were either <200 or >3500 so the midrange value of 2000 will be fine as the threshold.  As expected the different ADC readings changed one at a time according to the Gray code.

 

Link to comment
Share on other sites

Converting the ADC values to logic is easy

// Gray code logic levels
bool dirBit1 = false;
bool dirBit2 = false;
bool dirBit3 = false;
bool dirBit4 = false;

And in the loop;

    // Convert to logic levels
    dirBit1 = (dir1 > 2000);
    dirBit2 = (dir2 > 2000);
    dirBit3 = (dir3 > 2000);
    dirBit4 = (dir4 > 2000);

Next I need to convert the Gray code to binary.  I've found complicated looking code in a Google search but I think there should be something simpler.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.