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

0 Members and 1 Guest are viewing this topic.

Offline MadScientist267

  • Impossible Condition Curator
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1220
  • Karma: +25/-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: 90
  • Karma: +0/-0
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
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1220
  • Karma: +25/-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.

Online frackers

  • Full Member
  • ***
  • Posts: 219
  • 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
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1220
  • Karma: +25/-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

  • Jr. Member
  • **
  • Posts: 32
  • Karma: +0/-0
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

  • Full Member
  • ***
  • Posts: 88
  • Karma: +9/-0
  • Golden Valley 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
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1220
  • Karma: +25/-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: 82
  • 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

Online frackers

  • Full Member
  • ***
  • Posts: 219
  • 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

  • Full Member
  • ***
  • Posts: 88
  • Karma: +9/-0
  • Golden Valley 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

Online frackers

  • Full Member
  • ***
  • Posts: 219
  • 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!)