Go Down

Topic: Is it the sensors or code (Read 375 times) previous topic - next topic

Mike2323

Hi,

I am having a great deal of trouble getting a stepper motor to respond to changes in wind speed.

I can attach serial data.

I have contacted Paktronics asking if it's a.sensor issue.

Any help/direction would be appreciated

Thanks,

Mike

MarkT

You need to focus on one issue at a time - you have to get the data from the sensor (step 1), and then
control the stepper (step 2).

So where is the actual problem?

Its always best to test each piece in isolation first, not try to integrate everything together all
at once.  Baby steps, validate each step.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

pylon

Links to the used hardware would help too.

Mike2323

Hi and thanks for reply.

I have had r different code writers try and crack this.
I have to pay them as this is not skill I possess.

Having said that, when looking at the serial data I dont see the sensor been read. But Chris, Josh, Tim or Lyndon do not know how to better define, from all hardware specs and data, how to get that communication.

I approached Paktronics for any piece of information but no response yet.

I have attached specs etc of hardware.

I have previously attached code and video of outcome.

Thanks again.


The original scope is below if you want it.


DETAILS:  Wind speed Gate.

So I can send drawings but essential we have a small gate that swings 90 degrees and is by default always in the 'closed' or 0 degree position.

We are using -
1. Paktronics wind speed/direction sensor
2. Arduino Mega
3. Nema 23 stepper motor (4 pin configuration to L298N stepper motor driver)

NOTE:
1. When switched on (Arduino), a wind speed reading is taken and the gate moves to the desired location -

Closed - 0 degrees (no movement if wind speed is 20+kph - see 'stages' below),
30 degrees open,
60 degrees open or
open - 90 degrees).

2. A wind speed reading will be taken every second and the gate will open and close accordingly.

3. There are 4 stages -

0 degrees (closed) - Wind speed 20+kph
30 degrees -              Wind speed 15 - 20kph
60 degrees -              Wind speed 10 - 15kph and
90 degrees (open) - Wind speed 0 - 10kph

4. Rpm is slow, say 15 but again I will need to easily be able to change the intervals between readings, rpm, steps per movement etc.

5. From closed to open = 6 rotations cw.

So every stage is 2 rotations either cw or ccw depending on where the gate is located.
Simply put, if the Arduino was powered up and the wind speed was read st 45kph, the gate wouldn't move.
Or,
If the Arduino was powered up and the wind speed was read st 9kph, the stepper would rotate 6 times CS putting the gate in the open position.
If the next reading was 15kph the stepper would rotate 4 times ccw putting the gate in the 30 degree position.

NOTE FOR ARDUINO
1. If a single Mega cannot handle taking wind speed and wind direction readings simultaneously let me know. We will have to use 2 completely different sensor/module and Arduino boards.

Mike2323

Ok it's not sending Serial data or Sensor specs / data.
I just have to work this out.

pylon

Quote
I have attached specs etc of hardware.
No, you haven't. We expect links to all used hardware (except Original Arduino boards) and not smartphone screenshots. We must have schematics of the used wind sensor board and at least a manual of the motor driver.

Quote
1. If a single Mega cannot handle taking wind speed and wind direction readings simultaneously let me know. We will have to use 2 completely different sensor/module and Arduino boards.
That's definitely not a problem.


Mike2323

Sorry for screen shots.
I am very bad at this.

I have attached some of the info you requested.

I have given the specs for the L298N only because I was using it throughout the test.

Needing higher amps I must move to to Nucleo or Geeko.
I have used the Geeko before with Nema 34.
I have not used Nucleo before but it was recommended.

I cant thank you enough,

Mike

Mike2323

This is the only spec I can get for the sensors.
SKU - sen0186


https://www.dfrobot.com/wiki/index.php/Weather_Station_with_Anemometer/Wind_vane/Rain_bucket_SKU:SEN0186

pylon

Post the serial output you get (no screen shots! Post the text and best put code tags around it)!

wvmarle

From the face of it this sounds like a quite straightforward thing to do. A Mega should easily handle it; a basic Uno/Nano/Pro Mini would handle a simple task like this just fine, too.
 
Basically you have to start with two sketches:
1) a sketch that reads and prints (to the Serial monitor or LCD display or whatever convenient) your wind speed sensor.
Make sure this works, and you see the numbers you're expecting. Now you're already 1/3 there.

2) a sketch that controls the stepper motor, and with it the gate. Just move it to 0 deg, then 30, 60, 90, stopping for a few seconds at each point, and back again. Preferably in the form of a function that takes the position as input.
There is no mention of a "home" sensor. A stepper motor doesn't know where it is when switching on, so you need some kind of "home" position. A magnetic sensor, microswitch, something like that. Your sketch should start by moving the gate to the home position when starting up.
Now you can control the gate. 2/3 done.

3) Merge the two together. Based on the speed of the wind, change the gate (add hysteresis and some delayed reaction: more than say 10 or 20 seconds higher/lower than a certain threshold before taking action).

That should be all there is to it.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up