Author Topic: Arduino - where to start?  (Read 5421 times)

0 Members and 1 Guest are viewing this topic.

Offline MadScientist267

  • Impossible Condition Curator
  • Hero Member
  • *****
  • Posts: 1514
  • Karma: +44/-4
  • Rules? What rules?
Re: Arduino - where to start?
« Reply #15 on: February 10, 2017, 11:24:42 pm »
On temp measurement... Dallas 1 wire bus (eg DS18B20 etc).

For analog anything, AREF is your friend.

I have a similar hack for the USB now as well, albeit with the 5V lead completely disconnected. I left the USB shield and negative supply pin in place, which still can cause ground loop effects on things, but I figure provides a little insurance against any common mode voltage that might somehow be present from taking out the port in the laptop. Course if it's strong enough.....
Wanted: Schrödinger's cat, dead and alive.

Offline welshman

  • Full Member
  • ***
  • Posts: 136
  • Karma: +6/-1
Re: Arduino - where to start?
« Reply #16 on: February 11, 2017, 06:55:36 am »
something i found very usefull when dealing with erratic values from adc's https://github.com/dxinteractive/ResponsiveAnalogRead . it can take a value from analogread or be given a value directly and then remove the noisy readings to give a good stable reading. much better than smoothing.

Offline MadScientist267

  • Impossible Condition Curator
  • Hero Member
  • *****
  • Posts: 1514
  • Karma: +44/-4
  • Rules? What rules?
Re: Arduino - where to start?
« Reply #17 on: February 11, 2017, 05:06:31 pm »
Appears to be just a complicated oversampling routine...?
Wanted: Schrödinger's cat, dead and alive.

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: Arduino - where to start?
« Reply #18 on: February 11, 2017, 05:17:58 pm »
Appears to be just a complicated oversampling routine...?

Its a type of IIR (Infinite Impulse Response - actually an exponential moving average) filter with a second order (i.e. rate of change) adjustment on the Alpha value applied to the input with a 'deadband' to further stabilise constant values.

Reasonably useful provided you're mindful of the implicit delay in getting an output from it.
Robin Down Under (or are you Up Over!)

Offline MadScientist267

  • Impossible Condition Curator
  • Hero Member
  • *****
  • Posts: 1514
  • Karma: +44/-4
  • Rules? What rules?
Re: Arduino - where to start?
« Reply #19 on: February 13, 2017, 01:42:04 am »
Hmm ok, might have to give that a good look see... cool.
Wanted: Schrödinger's cat, dead and alive.

Offline eidolon

  • Full Member
  • ***
  • Posts: 53
  • Karma: +2/-1
Re: Arduino - where to start?
« Reply #20 on: February 13, 2017, 08:04:55 pm »
Just in playing around with Miles Burton's DS18B20 library with multiple sensors, I find I get occasional bad reads. Figure they will figure it out some day. These are always easy to filter out because they are read as 0.  I only do heating so that is easy.  You still can't beat good old analog for doing runs of 100 feet an more and filtering out noise.

Offline Pete

  • Sr. Member
  • ****
  • Posts: 385
  • Karma: +19/-1
  • Mount Barrow Tasmania
Re: Arduino - where to start?
« Reply #21 on: February 14, 2017, 02:34:48 pm »
Well it was a steep learning curve, but I have my solar hot water controller up and running now. It has worked great for the last couple of months.
I ended up using averaging to get the readings from the sensors accurate. I think the problem was really down to a bad build the first time as my pump would turn on and off regularly after a short run. I rebuilt the unit and the problem ceased. So now I have a working unit that does what I want.
I used an arduino nano, a 1.8" tft screen to display temperatures and pump state and a relay to run the pump.
I did kill a couple of Arduino chips trying to run the unit of 12 volts, though. In the end i used a breakout board with its own regulators, I also used a 7809 three terminal regulator to make sure that the small power supply on the breakout board was not overloaded.
I have attached the code for anyone who wants to build one.
I also found that the relay board I used had opto isolation and worked with a "low input" so I used a BC558 transistor as an inverter to invert the output from the Nano chip to drive the relay.
Pete

Offline MadScientist267

  • Impossible Condition Curator
  • Hero Member
  • *****
  • Posts: 1514
  • Karma: +44/-4
  • Rules? What rules?
Re: Arduino - where to start?
« Reply #22 on: February 15, 2017, 02:30:13 pm »
I did kill a couple of Arduino chips trying to run the unit of 12 volts, though. In the end i used a breakout board with its own regulators

Yeah, dunno how, but magic smoke events didn't come to mind immediately for me with this thread... they're certainly prone to it.

I'd recommend never using the onboard regulator unless you're only powering the chip itself and maybe some very minimal requirements needed for sensors. This seems to be particularly true when it comes to "shield" displays and the backlights. Would appear that the LEDs just pull things way too close to the regulator limits depending on what you've got. Not worth the risk. I use "full spec" 7805 or some other form of external supply now for anything like that, haven't had any trouble since.


Quote from: eidolon
Just in playing around with Miles Burton's DS18B20 library with multiple sensors, I find I get occasional bad reads. Figure they will figure it out some day.

The good news is, there are relatively simple workarounds for this provided the bus itself isn't experiencing severe interference. There are ways to read the bus blazing fast, and between CRC and a couple other tricks, can eliminate the bad reads.

I'll never use NTC/ADC for temp ever again whenever I can avoid it.

That said, I agree it's definitely got its uses (fan or PWM control, etc) but only when the outcome isn't in need of a calibrated number. Too much work hehe

Steve
Wanted: Schrödinger's cat, dead and alive.

Offline solarnewbee

  • Full Member
  • ***
  • Posts: 231
  • Karma: +1/-0
    • Cayenne Dashboard
Re: Arduino - where to start?
« Reply #23 on: February 15, 2017, 07:48:38 pm »
Hey Mad and Pete!

I just love those DS18B20 sensors especially when using them in conjunction with a site called Cayenne mydevices.com they have a pc, mac, android and ios dashboards to monitor and control your raspberry pi or arduino devices from anywhere in the world. Those sensors are automatically detected on GPIO4 and then you only have to fill in the labels for each.  They have made it very easy to set up and the Cayenne community pages offer lots of help, great people over there. For many of the sensors they give you an IDE sketch and after say the first button you program then you can just add on more buttons to the dashboard by adding widgets. They just released the MQTT bring your own thing for Arduino and other devices as well as sensors that are not included as standard fare at Cayenne. I have a Rpi3 up and running overseas, it works but readings are zilch since I wasn't able to get my panels on the roof. Next year though got to do it because there's 32 LFP's sitting in the electrical room ie. extra bedroom ha un-used. I'm working on a PLduino which is Mega 2560 based and of course it's kicking my behind.

Check it out it's fun

SN
SN

Any day above ground is a day for potential mishaps

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: Arduino - where to start?
« Reply #24 on: February 15, 2017, 08:28:07 pm »
I love 1-wire stuff. My irrigation controller (running on a wireless router - i.e. v. small Linux box) uses 16 GPIO chips (DS2413), 3 temperature sensors (DS18B20) and 2 battery monitors (to measure current/voltage - DS2438).

My wind turbine controller (Arduino Mega based) uses the same chips for power measurement, inverter control and temperature sensing.

There are libraries to implement your own functionality on an Arduino but operate as a 1-wire client so it just hangs off the bus like everything else. Very handy if you want to measure RPM or something similarly exotic ;)


Robin Down Under (or are you Up Over!)

Offline Pete

  • Sr. Member
  • ****
  • Posts: 385
  • Karma: +19/-1
  • Mount Barrow Tasmania
Re: Arduino - where to start?
« Reply #25 on: February 15, 2017, 11:06:58 pm »
MadScientist, yes I agree, it I have found that it is best to power external things like the relays from the regulator power supply. I think the onboard regulators on the shields died from trying to drop the 12 to 13.8 volt from the batteries to 5 volt. When they have only a 9 or 8 volt supply they seem to be able to handle it better.
As far as smoke goes, yes the Nano chips did seem rather easy to turn into smoke. I learnt as a kid from watching Lost In Space that once your gear goes up in smoke you either vacuum it our or hit it with a fire extinguisher. Then magically everything fires up again and there is no need to repair it.
Somehow in my world this does not work. So a couple of Nano's and a couple of Shields ended up in the bin.
Just as well we live in a throw away world eh.
Cheerio
Pete

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: Arduino - where to start?
« Reply #26 on: February 16, 2017, 12:17:20 am »
Most of the Nanos I have smoked have been the diode in series with the 5v - change the diode and away you go again ;)

Since you can get them from China for less than the local cost of the mega328p chip that on them, then I suppose you get what you pay for!
Robin Down Under (or are you Up Over!)