-
Posts
45,326 -
Joined
-
Last visited
-
Days Won
120
Content Type
Profiles
Forums
Gallery
Events
Blogs
Everything posted by Gina
-
Found this code but I think I would prefer to use code I fully understand! This still needs the bits converted to integer.
-
Thinking... Gray code to binary :- 0000 0 0 0001 1 1 0011 3 2 0010 2 3 0110 6 4 0111 7 5 0101 5 6 0100 4 7 1100 12 8 1101 13 9 1111 15 10 1110 14 11 1010 10 12 1011 11 13 1001 9 14 1000 8 15 int codeArray[16] = {0,1,3,2,7,6,4,5,15,14,12,13,8,9,11,10};
-
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.
-
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.
-
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).
-
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.
-
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.
-
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
This morning's dashboard display. Wind Speed not connected - currently working on the wind sensor connections. -
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.
-
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Still getting the problem with the Dashboard display!! Is the dashboard too "busy" - too many widgets? -
Incidentally, that roof with 4 x 120mm wheels and steel track from FH Brundell, can be pushed with one finger.
-
WOW!! That sure is a lightweight roof framework! I have a pair of 100x25mm each side with the wheels in between. The main roof framework is mostly 4x2 with some 6x2 (dropped back into Imperial!). Studding to support the 6mm plywood is 2x2. EPDM on top of the plywood. OK so I'm into over-engineering! 🤣. But it was that same roof that was lifted off by wind and dumped onto the fence upside down several years back. It too 4 blokes to lift it back on!! I have some very helpful neighbours.
-
I used the same track but bigger wheels. Very well made. Very smooth and easy running. I used 4 x 120mm diameter wheels with a very substantial and solid apex roof.
-
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
I don't seem to have that. But it's working so no longer a problem. Thanks anyway. Node-RED is on the same device as the broker so shouldn't need an IP address. -
No problem with grass growing here - plenty of rain!!! Devon is decidedly damp (except in a heat wave!!).
-
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Seems alright now. Tried changing the IP address in the browser again and this time it seems to have worked. That's additional to changing the IP address for viewing the dashboard and in all the clients. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Another problem. Think Node-RED needs the new broker IP address but I can't see where to set it. Getting this :- -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
-
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
RPi Zero W now replaced with the RPI 3B with wired comms, all clients updated to the new broker IP address and everything working. The microSD card from the Zero now in the 3B and all Node-RED links were preserved. Display seems solid! What a difference!! Of course, logged data is gone but it was getting to the state where the display was just occasionally working for a few seconds and virtually useless. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Here's the latest Dashboard screenshot, before I unplug the RPi Zero and replace it with a 3B. Wind Speed isn't running - I've dismantled the test rig. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
I shall look at all ideas for logging weather data and displaying and also the Arduino UNO hardware that I used before plus other ideas. I think I would like to save the data to an SD card. I haven't decided on a format for certain but comma delimited text looks a prime candidate. I like simple. I still hope to make a wall weather display with gauges and a 360 degree wind direction dial. Servo motors would make good gauges I'm thinking with stepper motors for the wind direction. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Guess I'll just use what I've got rather than try such a "way-out" solution. I've already got the wind vane with built-in Gray encoder printed and just have one or maybe two more parts to print and I shall have the vane hardware finished. Have the stripboard and components to solder though. There are 4 resistors needed for the optical sensors. Not sure about the IR emitters - I'll connect them all in series and see if a resistor is needed to run off the 5v supply. I'll sort that out tomorrow - I've finished for tonight. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Found an example of a single track Gray encoder. That would produce a much smaller and simpler wind vane encoder, but this is a 5 bit coding yielding 30 different positions. The down side is an extra optical sensor and more complex decoding. Probably the "sledge hammer" method of a look-up table would be to simplest approach. Also, the smoothing algorithm may not work. So whilst this is very interesting I'm afraid it's probably "too clever"!! Link here :- Gray Code https://en.wikipedia.org/wiki/File:Animated_Graycode.gif -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Looking at the actual ESP32 module the top 2 pins on the left are labelled VP and VN so I think I'll use the next 4 - D34, D35, D32, D33. These are all ADC1 so should be fine. I'm using D4 (GPIO4) for the anemometer Hall sensor. -
Setting up an MQTT system for Weather Sensing and Astro Control
Gina replied to Gina's topic in DIY Astronomer
Now looking at the wind vane optical sensor connections to the ESP32. These are analog so need the ADC pins. There are 15 and I need 4. But if using WiFi (which we are) there is a limitation on which pins to just 6 - see blue panel below. I shall use the top 4 on the left, next to the EN pin.