Date   

OCS improving time and date and extacting two years data

koal01
 

Hi Howard,

In my installation the ntp feature to synchronize time has nerver been a real success, i'm always several minutes late , i tested several ntp servers and it doesn't change anything.
Would it be a big job to add a GPS module using the second ic2 interface left ? i have several ones and in terms of accuracy i find them much better.
Second question is around all data i saved with OCS during years, i guess it would be a hard task for a mega to display months or a year data with the charts.js ?!
I'm wondering if OCS is able to handle long periods such as one month, 6 months, 1 year, 2 years wtihout perturbating itself while displaying graphs or is it more reasonable to find an external solution ?
Thank you


Re: Two hotwire wind sensors ?

koal01
 

Concerning direction, not obvious to get it properly i know. 
Anyway thank you for the code that allows to handle mutliple hotwires.


Re: Two hotwire wind sensors ?

Howard Dutton
 

On Wed, May 19, 2021 at 01:17 PM, koal01 wrote:
A second question. If the test of adding two Hotwires improves the accuracy do you think it would be possible in the future for OCS to handle  4 hotwires so we can increase accuracy and get the right direction of the wind ? 
Seems to me wind direction with this is impossible.

Adding more would be follow the same pattern, trivial.


Re: Two hotwire wind sensors ?

koal01
 

So great and so nice  !  I’m going to order a second sensor and test the changes. I was not sure this feature was possible so I prefered waiting. May I ask a question ? I don’t know the modern device library but I was wondering since we have two axis detected  if a kind of direction of the wind is possible ? For example in my installation the first Hotwire is oriented east-west and the second will be oriented north-south. For instance if the wind is coming from west since the value is given by Hotwire1 can  OCS display a kind of suggestion « east-west » just near the wind speed index in the weather panel. A second question. If the test of adding two Hotwires improves the accuracy do you think it would be possible in the future for OCS to handle  4 hotwires so we can increase accuracy and get the right direction of the wind ? 

I’m going to order the component, upgrade soft and hardware and let you know !

Thanks again Howard 


Re: Roof stepper motor support

Howard Dutton
 
Edited

I've never even thought about using it like that but if it works, great.

Basically any digital (or "analog" for that matter) pin on the Mega2560, not used for other purposes, can provide the EN and DIR signals to the DRV8825.


Re: Two hotwire wind sensors ?

Howard Dutton
 


Guess the following should work.  It takes the higher windspeed from the two devices and returns that...

// -----------------------------------------------------------------------------------------------------------------
// gets windspeed in kph
// for the Modern Devices wind sensor, https://moderndevice.com/product/wind-sensor-rev-p/

#define HotWire1Pin A6    // wind sensor analog pin hooked up to Wind P sensor "OUT" pin (primary)
#define HotWire2Pin OFF   // wind sensor analog pin hooked up to Wind P sensor "OUT" pin (secondary)

// return (invalid) if not implemented or if there's an error
double weatherWindspeed() {
  int hw1ADU;
  int hw2ADU;
  if (!windspeedGood) return (invalid);

  hw1ADU = analogRead(HotWire1Pin);
  if (HotWire2Pin != OFF) hw2ADU = analogRead(HotWire2Pin); else hw2ADU = hw1ADU;

  double windMPH1 = pow((((float)hw1ADU - 264.0) / 85.6814), 3.36814);
  if (isnan(windMPH1)) windMPH1 = 0;
  double windKPH1 = windMPH1 * 1.60934;

  double windMPH2 = pow((((float)hw2ADU - 264.0) / 85.6814), 3.36814);
  if (isnan(windMPH2)) windMPH2 = 0;
  double windKPH2 = windMPH2 * 1.60934;

  if (windKPH2 > windKPH1windKPH1 = windKPH2;

  if (windKPH1 < 0 || windKPH1 > 350windKPH1 = invalid;
  return (windKPH1);
}

bool initWindspeed() {
  return true;
}


Re: USR-ES1 W5500 Lose IP

rad112g@...
 

Yes, it is configured to pin 11, some devices like a Zyxel router dont recognize it as a conecetd device  but still works at the configured ip, the results are the same if i config for static ip


Two hotwire wind sensors ?

koal01
 

Hi Howard,

Experimenting the modern device hotwire sensor which is actually oriented east-west in my installation i was wondering if adding a second one north-south would be possible in OCS environnement. We know that the device has the drawback of flow directions and i saw wind sensor flow projects using multiple sensors. 
https://miniwindtunnel.wordpress.com/tutorial/
Aflter more than a year experimenting this sensor, i've learnt how to use it as a warning sensor and i like it since it is reliable in this specific use.
Now i'm wondering how improving the accuracy of this sensor and i would suggest to test this upgrade and report.
Wind measurement is important in weather conditions, a clear night with all sensors ok but a crazy wind should result in an unsafe general conditions, that's why i would like to work on that.

Thank you


Roof stepper motor support

rad112g@...
 

I tested to work a stepper motor to open/close roof using the ROR_POWER_RELAY pin PWM to a DRV8825 step pin, i took pin 3 and 5 for dir and en and added digitalWrite code for those pins on Roof.ino tab.

It works but wanted to know if it is correctly using this pins or is preferible to use other ones.


Re: Noise on Voltage/Current analog read

Howard Dutton
 

On Wed, May 5, 2021 at 10:58 AM, <rad112g@...> wrote:
Works fine fine fine, i implemented it for both current and voltage, thanks for your time, congrats for your knowledge.
I will come back around to the OCS for a good once over, and when I do things like this will be built-in.


Re: Noise on Voltage/Current analog read

rad112g@...
 

Works fine fine fine, i implemented it for both current and voltage, thanks for your time, congrats for your knowledge.


Re: USR-ES1 W5500 Lose IP

Howard Dutton
 

You did wire in and handle the W5500 reset pin right?

Other than that it seems to be an library level or below issue and not hardware I've ever tested the OCS with.  We do use the W5500 with somewhat similar code for OnStep and that doesn't just up and stop working after 10 or 20 minutes, though again DHCP isn't something we use nor is the Mega2560.


Re: Noise on Voltage/Current analog read

Howard Dutton
 

On Wed, May 5, 2021 at 09:17 AM, Howard Dutton wrote:
...so it takes the analog sample in the main loop, averages, then drops it in a global variable.  The "(99 + 1) / 100" can be "(999 + 1) / 1000" or "(24 + 1) / 25", etc.  The depth of averaging gives the frequency response vs. noise tradeoff.  This is referred to as a rolling average and has the advantage of not requiring a massive array of values like a normal average does.
You could also bracket the analogRead() and averaging code so it runs at a fixed interval largely independent of the MCU frequency, etc.  Below is for 1 Hz samples in which case you would probably want the depth of averaging to be only 5 or 10 so it's fairly responsive to changes.

static unsigned long lastSampleTime = 0;
if ((long)(millis() - lastSampleTime) > 1000) {
  lastSampleTime = millis();
  // the code
}


Re: Noise on Voltage/Current analog read

Howard Dutton
 

To do this well you'd probably want to change some code from WebAjax:

#if STAT_DC_CURRENT_ANALOG != OFF
  f = toDCAmps(analogRead(STAT_DC_CURRENT_ANALOG));
  strcpy_P(temp1,htmlInnerStatusDCA);     dtostrf(f,6,1,ws1); strcat(ws1,"A"); if (f==invalid) strcpy(ws1,"Invalid"); sprintf(temp,temp1,ws1); client->print(temp);
#endif

...so it takes the analog sample in the main loop, averages, then drops it in a global variable.  The "(99 + 1) / 100" can be "(999 + 1) / 1000" or "(24 + 1) / 25", etc.  The depth of averaging gives the frequency response vs. noise tradeoff.  This is referred to as a rolling average and has the advantage of not requiring a massive array of values like a normal average does.

// global scope
float currentReading = 0.0;

// in the main loop somewhere
static int currentReadingRaw = 0;
currentReadingRaw = analogRead(STAT_DC_CURRENT_ANALOG);
currentReading = (currentReading*99.0 + currentReadingRaw) / 100.0;

........................

// new code for WebAjax.ino
#if STAT_DC_CURRENT_ANALOG != OFF

  f = toDCAmps(round(currentReading));
  strcpy_P(temp1,htmlInnerStatusDCA);     dtostrf(f,6,1,ws1); strcat(ws1,"A"); if (f==invalid) strcpy(ws1,"Invalid"); sprintf(temp,temp1,ws1); client->print(temp);
#endif


USR-ES1 W5500 Lose IP

rad112g@...
 

I installed the USR-ES1 ethernet adapter, it has W5500 chip, works well but i have a little issue with it when conected to any router in DHCP mode (i use "Ethernet.begin(m);" instead of "Ethernet.begin(m, ip, myDns, gateway, subnet);" and i use DHCP binding, but occurs also in static IP mode:
 
After some sporadic time (about 10 - 20 minutes) the OCS disappears from conected LAN devices or re-appears with IP 0.0.0.0, however the OCS is still fully working throught the configured IP address, this happend to me on a ZTE router, the issue is different depending on wich router model is attached to, on a D-Link instead of get an IP (it shows "---  ---- ----") but still fully working, on a Huawei router lease time is not renewed automatically and OCS dissapears after 1 minute, but still fully working at the configured IP (in this last case i didnt used DHCP binding).

Same occurs with the updated arduino lib for W5500, ethernert2, Ethernet3 or Wiznet lib


Noise on Voltage/Current analog read

rad112g@...
 

Hello Howard, im getting very different values for voltage and current reading, im using 2k2 and 220 Ohm for voltage and ACS712 20A (0,1V/A), some instant measurements differs in about 1V/1A from others. Tried to install 1uF electrolitic or 0,1uF ceramic capacitors but didnt get any sustancial change, there are a lot of example codes for average analog read but dont know how to implement them in your OCS.
Could you give some code for average?


Re: Problems after implementing weater functions

Laurent HOUSSAYE
 

Good morning
Thank you Howard for your answers.
I will slow down the I2C bus. Can I go down as low as 10 or 20 Hz ? is there a minimum frequency specified ?


Re: Problems after implementing weater functions

Howard Dutton
 

On Thu, Apr 22, 2021 at 10:43 AM, Howard Dutton wrote:
I2C speed 10000, is in Hz.
Sorry, glitched on that, it's 20000 Hz.


Re: Problems after implementing weater functions

Howard Dutton
 

I2C speed 10000, is in Hz.

Weather stuff updates at 32 second intervals.  Log entries every 30 seconds are from running averages read from sensors every 2 seconds.  Data is pulled from sensors as needed, one is free to break down the sensor readings so it might be several 2 second polls before data becomes valid then updates at several seconds between, that keeps blocking (i.e. code sitting and waiting) times short.


Re: Problems after implementing weater functions

Laurent HOUSSAYE
 

One problem resolved ! The Weather Charts are now correctly displayed once I have cleared the browser (Firefox) cache...
Now it is time to tackle the I2C bus sensors problem !
Thanks a lot Howard for your support.
Laurent

121 - 140 of 528