Jump to content


Photo

How to make an automatic dew controller - Arduino

  • Please log in to reply
247 replies to this topic

#126 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 13 December 2012 - 05:29 PM

Phil,
Unless you have the DS1307 RTC (Real Time Clock) and 24C32 EEPROM modules, you can't go to 3.8 or 3.9.
If you send me your current sketch, I can integrate the 3.7 and 3.9-beta changes into it leaving out the 3.8 stuff for the RTC and larger EEPROM.

Do you have a red LCD screen? If not what colour?
Paul

#127 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 13 December 2012 - 05:41 PM

Dan,
I don't mind sharing or helping. Hopefully other people will learn from it and not have to go through some of the stumbling blocks and learning curve that I had to. :smashpc:
Paul

#128 mitaccio

mitaccio

    Viking 1

  • *****
  • Posts: 514
  • Joined: 17 Mar 2009
  • Loc: Oahu, Hawaii

Posted 13 December 2012 - 05:49 PM

To Pauls72: how did you run the reset button through? I didnt find a good way of making the button pass through from the case to the arduino.

#129 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 13 December 2012 - 06:05 PM

OK Paul, I'll send my sketch tomorrow, its on another PC.

I'm using the plain vanilla blue/grey LCD. Does the red one have a clearer display when scrolling?

Phil

#130 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 13 December 2012 - 06:17 PM

I have the reset button on the shield board located under the hole. I took 3 (of the 4) of those little square white buttons that came with the case and glued them together in a stack. I then used a very small drop of hot glue and glued it to the actual reset button. Hot glue is nice, because you can peal or scrape it off and it remains a little flexible. You have to use a small screwdriver or something to kind of guide it through the hole when you put the case back together. You can see them stacked up in this picture.

Posted Image

#131 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 13 December 2012 - 07:25 PM

I just took this video with my cell phone. Sorry I can't hold it that still. The video is slightly out of focus, the display is perfectly clear.

https://www.youtube....h?v=VMPlu6-BRuY

#132 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 14 December 2012 - 08:34 AM

Paul,
Your LCD is very much clearer than mine, it doesn't appear to suffer from the lag that mine does. Can you please tell me which one you have?

My latest sketch is attached.

Phil

Attached Files



#133 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 14 December 2012 - 09:42 AM

I got the same red LCD that mitaccio used from Sparkfun.
https://www.sparkfun.com/products/791?

#134 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 14 December 2012 - 12:35 PM

Paul,
That LCD doesn't seem to be available in the UK. However, I have found a red backlit with orange characters. I've queried the latency with them. If this one is OK then I don't need to worry about having a 4 line display. Cheap too, £4 (6$)

#135 mitaccio

mitaccio

    Viking 1

  • *****
  • Posts: 514
  • Joined: 17 Mar 2009
  • Loc: Oahu, Hawaii

Posted 14 December 2012 - 08:41 PM

I have some questions about the setup you guys are doing. Keep in mind, that even though I got this thing started that I am a beginner at electronics and programming. This was my first project ever!

1)What is the concensus on the DHT11 vs DHT22? Is the range worth the delay?

2)Ports: How often do you need 4 heaters?

3)Powering the arduino. I run my arduino off the 12v supply. I haven't had any issues, but are there advantages to running it separately at a lower voltage?

4)Duty Cycle/PWM I know my coding in this area was very simple, but it seems to work well in my climate. What advantage over my original coding is there to the Duty Cycle/PWM? It seems that you are using a pot to adjust the duty cycle. Doesn't this remove the automation?

I have to say, I am super pleased at how much this has taken off. Thanks for keeping this going and improving as much as you have.

#136 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 15 December 2012 - 12:47 AM

1) For those of us in other parts of the world, the change from the DHT11 to the DHT22 is probably the most important and even mandatory.

DHT11
0° to 50°C (32° to 122°F) ±2°C
20 to 80% Humidity ±5%

DHT22
-40° to 80°C (-40° to 176°F) ±0.5°C
0 to 100% Humidity ±2%

Here in the Midwest in winter the temperature routinely fall's well below 32°F and the humidity can go below 20%. In heat of summer the humidity can exceed 80%. As a secondary plus, the DHT22 is more accurate.

The way the program currently is structured, we only go through the main program loop every 12 seconds. So we look at the DHT sensor a few times pretty quickly and then it sits for the next 10-11 seconds. So the delay of the DHT22 only being able to be read every 1/2 second isn't an issue. But even at this rate we can adjust the dew straps on/off up to 5 times per minute.

2) Scope, Eyepiece, Finder scope, Telrad, Mount Hand controller.
When imaging I will take out 2 scopes, one for imaging and one for visual. Scope and Guide scope, then Scope and Eyepiece on the second one.

3) There is nothing wrong with powering everything off of one 12V supply. The main issue is the dew heater straps use a lot of power. I didn't want that much current flowing through the Arduino board or shield, especially if you have a dew strap or cable short out. A dew strap for my C11 uses 1.57A, plus for the 2" eyepiece .32A, plus for the guide scope or finder .5A. So it is possible to end up with 4-5 Amps going to the dew straps, this would smoke the runs off the Arduino or shield. So I have separate isolated inputs for the two. From my battery I have a cable with 2 connectors at the end. One with a 2.1mm connector for the Arduino and the other with a 2.5mm for the dew straps.

I suppose if you run the Arduino off of a 9V transistor battery or 4AA 1.5V batteries it will run cooler, but I didn't find this as an issue.

4) Well the system currently uses both your original concept for turning the dew heaters on/off, plus it has variable duty cycle. By reducing the duty cycle you reduce the wattage/heat output of dew straps. This gives you give a lower more even heat, slower change in temp. But it lets me use my C11 dew strap on my 102mm MAK, because I can adjust the wattage way down. This is important with home made dew heater straps, you can control their heat output. Now with the latest changes we are testing you can run each of the different outputs at different duty cycles.

Although we could drive the dew straps in an analog manner, to control the percentage without introducing some feedback circuitry this would be harder to regulate or know exactly what percentage we are driving the straps at. Now using Pulse Width Modulation when a dew strap needs to be turned on, we are turning the straps on/off at about 10HZ. We are then controlling the width of the positive and negative portions of the pulses with fairly accurate control. Wen we run at 100% then stay in all the time they are required. When using PWM and under driving your dew straps, your dew straps will last longer electrically.

Posted Image

You had a great idea, I wish that I would of though of it. I learned my electronics in the early to mid 1970's. So I learned about both vacuum tubes and solid state electronics. Solid State was in it's infancy and I kind of grew along with it for 20 years or so. Then I transitioned over to the application software side of the world. The Arduino is programed in a OOP (Object Oriented Programing) language similar to C++. And the libraries are in C++. Now, I deal in some totally different languages, but I have learned other OOP languages on different systems (Algol, Pascal, Java, Visual Basic) over the years. If you know the concepts behind OOP languages, it makes it easier to learn and understand other OOP style languages. There are a lot of things similar between all OOP languages. Things like Class, Function, passing variables and pointers and objects, use of pointers, defining variables, types of variables, use of casting, overloading operators are all common to all OOP's. The commands, their syntax and uses is different between the different languages, but not totally foreign.

I had never heard of an Arduino before I read your post on this project. I was looking at building a Dew Controller, but nothing as sophisticated as this. When I first built mine, the program wouldn't even compile. I soon found there are a bunch of different versions of the libraries for the different devices floating around the web. Getting the correct combination was quite a challenge.

I also wanted to increase the ports from 2 to 4 and had some other ideas for improvement that kept growing over time. So this project motivated me to learn the Arduino, it's programing language and some C++.

#137 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 17 December 2012 - 01:10 PM

Phil,
Attached is a semi-consolidated 4.2a beta version with the multiple duty cycles for the different ports. I took your sketch and added in my changes from 3.7, some of 3.8 and the 3.9c-beta versions. I also made a change so that the Dallas onewire sensor values are saved in either Fahrenheit or Celsius accordingly.

What is different for sure is that I have the additional code for the RTC (Real Time Clock) and EEPROM 32K memory modules. I now have a idea/plan for making a version that we could both use. That way it will make it easier for us to stay in sync.

I wish my Bluetooth stuff and my DHT22 would get here soon.
Paul

Attached Files



#138 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 18 December 2012 - 02:20 PM

Paul,
I think in the New Year, once recovered from the cost of Christmas, I'll buy another Arduino Uno plus proto shield, and start getting to grips with the coding. Then perhaps to join in with some development.

When you do finally get your BlueToothe device, let me know what it is exactly, so I can take a look at it for future reference. I may then go ahead a buy one myself to experiment with.

As a matter of interest regarding the RTC, have you implemented that as a device for sidereal time checks?

Phil

#139 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 18 December 2012 - 06:04 PM

Phil,

The date/time is read from the RTC module and displayed during the power up sequence.

During operation I alternate between the Arduino powered up time and the actual time. So the first time scrolling through I display the powered up time with a little up arrow to the left of it. The next time through I display the actual time from the RTC module (HH:MM) in military or 24 hour clock format. I thought it would be nice to have the time on the display since it was already lit up.

Last I use the date time when storing off the all the reading to the external EEPROM. I save the date and time along with the temperature, humidity dew point and all temp of all 4 Dallas sensors.

I am using an DS1307 RTC module. Cost was about $4 (I'd guess about £2).

So I think I have finished consolidating and have one version that should work for both of us.

Some new parameters:
boolean noRTC = 0; // Ver 4.3 - set to 1 when there is no Real Time Clock module present.
boolean noExtEEPROM = 0; // Ver 4.3 - set to 1 when there is no External 32K EEPROM module present.

// Ver 4.3 - Make displayed port names variables.
// Put your output port names here, the maximum size including the equal sign is 6 characters.
char port1Display[7] = "OTA1=";
char port2Display[7] = " Eye=";
char port3Display[7] = " OTA2=";
char port4Display[7] = " Aux=";

All the parameters that you will need to change should be grouped together in the source. The source has mine, so you will have to change them.

There are a few small changes/enhancements that I made while making the other changes. I started making more comments when I made changes, this is to make it easier for you to follow along. I was not about to unsolder or cut the wires to my RTC or external EEPROM modules, so I will rely on you to test that part.

Awhile back I picked up a second Arduino, a prototyping board and a bunch of the jumper wires. It makes life so much easier when messing with this stuff. The Arduino Uno is a clone from Hong Kong for like $13 (£7). The only real difference I noticed is it uses USB serial port 7 instead of 5.

Regards,
Paul

Attached Files



#140 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 20 December 2012 - 12:45 PM

Thank you Paul, I might just RTC myself. However, in order to do this, I'll have to get a bigger box, mine is crammed to the brim as it is; it would sense anyway, making it easier to mess with things as this seems to be an ongoing project.

I've looked at the BlueTooth links, very neat gadgets, and very cheap, I'll see if I can locate them here. Is there an existing program for send commands from a PC? Or is this something else that has to be developed?

Good idea putting in more comments. I am currently on the programming learning curve by reading the two books I bought. I just need to buy that second Arduino - I may get a clone too. One of the books refers to downloadable sketches to experiment with, I'm just about to get them and work through them. Your previous notes are coming in very handy for clarity. Its all beginning to make sense now.

Phil

#141 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 20 December 2012 - 02:35 PM

Paul,

I found this one on fleabay, looks the same device:

http://www.ebay.co.u...RF-Transceiv...

So, New year may seeing me going this routs too. Also found the RTC arduino compatible module, very cheap.

#142 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 20 December 2012 - 02:51 PM

Paul,

I found this one on fleabay, looks the same device:

http://www.ebay.co.u...RF-Transceiv...

So, New year may seeing me going this routs too. Also found the RTC arduino compatible module, very cheap.


Yup, looks like the exact same one.

On many of these modules the boards may be slightly different, but electrically and software command wise they are the same.

Is there an existing program for send commands from a PC? Or is this something else that has to be developed?

In the top of the serial monitor window there is a line where you can input text (or in our case commands) and click on the send button.

Posted Image

By the way, if you look at my dew controller, the RTC and external EEPROM modules are wrapped in electrical tape and placed vertically on edge along the right hand side. Talk about not having room. :grin:

#143 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 20 December 2012 - 10:45 PM

Phil,
I found a few variables that I missed when replacing the names out of the code and making them all generic.
Paul

Attached Files



#144 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 21 December 2012 - 11:41 AM

Paul,
Yes, I'm aware of the serial monitor Send line, just haven't used it yet.I'm starting to look at he code required to do this 2 way communication.

Phil

#145 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 22 December 2012 - 11:27 AM

Thanks for the new code Paul. I keep that on file for the time being. I'll probably get the RTC in the New Year, and perhaps get the BlueTooth items too.

Phil

#146 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 04 January 2013 - 04:05 AM

Paul,
I'm now taking a look at the latest code posted: 20121220

It appears now that the hex codes for the Dallas sensors no longer need to be defined. Previous code for my sensors:

DeviceAddress LX200 = { 0x28, 0xEB, 0xF5, 0x4A, 0x04, 0x00, 0x00, 0xDE };
DeviceAddress ED80 = { 0x28, 0x2A, 0xDC, 0x4A, 0x04, 0x00, 0x00, 0x7D };
DeviceAddress EP = { 0x28, 0xC0, 0xDD, 0x4A, 0x04, 0x00, 0x00, 0xD4 };
DeviceAddress Box = { 0x28, 0x4C, 0xF2, 0x4A, 0x04, 0x00, 0x00, 0x56 };

New code:

DeviceAddress Port1In, Port2In, Port3In, Port4In;

Where the device addresses are variables, meaning that if different straps + Dallas sensors are used, the addresses are automatically determined by the code in setup and the main loop.

Am I understanding this correctly Paul?

Phil

#147 Pauls72

Pauls72

    Viking 1

  • *****
  • Posts: 625
  • Joined: 28 Oct 2007
  • Loc: LaPorte, IN

Posted 04 January 2013 - 08:45 AM

Phil,
You are correct.

Here is where basic setup is done:

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Port1In, Port2In, Port3In, Port4In;


Then here is where we search to see how many sensors are present, up yo 4. This is the actual search for the first sensor. !sensors.getAddress(Port1In, 0)

void setup() {
Serial.begin(9600);
Wire.begin();
sensors.begin();
//Search for devices on the bus and assign based on an index
lcd.begin(16,2);
resetLCD();
lcd.createChar (0, upSymbol); // load special character to the LCD - an up arrow used to indicate power up time in front of the power uped time on the display.
resetLCD();
lcd.print("Sensors Found: ");
if(!sensors.getAddress(Port1In, 0)){Serial.println("Unable to find address for Device 0"); lcd.setCursor(0,1); lcd.print("No Sensors ");}else {ts0=1;lcd.setCursor(0,1); lcd.print("#1 ");};
if(!sensors.getAddress(Port2In, 1)) Serial.println("Unable to find address for Device 1"); else {ts0=ts0+1; lcd.print("#2 ");};
if(!sensors.getAddress(Port3In, 2)) Serial.println("Unable to find address for Device 2"); else {ts0=ts0+1; lcd.print("#3 ");};
if(!sensors.getAddress(Port4In, 3)) Serial.println("Unable to find address for Device 3"); else {ts0=ts0+1; lcd.print("#4 ");};
delay(displayDelay2);
sensors.setResolution(Port1In, 10);
sensors.setResolution(Port2In, 10);
sensors.setResolution(Port3In, 10);
sensors.setResolution(Port4In, 10);


This should give you an idea of how the sensors/library can be used.
http://milesburton.c...Control_Library

Paul

#148 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 04 January 2013 - 10:10 AM

Paul,

I Have now run the sketch after tweaking for my naming. It does exactly what I thought. This is a really useful feature Paul, when using the unit on different scopes with different straps.

I have tried putting in the few lines of code - just 7 -for the IR keypad. However, It won't compile as the sketch is now to big; 33,268 bytes. So, it looks like something will have to go in order to implement the keypad; I may remove all RTC stuff, as I don't think I really need that.

More later.

Phil

#149 ThadeusB

ThadeusB

    Explorer 1

  • -----
  • Posts: 71
  • Joined: 14 Nov 2012
  • Loc: Somerset, UK

Posted 08 January 2013 - 02:41 AM

Hi Paul,
I have made a few very small changes to make things ordered and logical. I had been thrown slightly, by the port order not matching pinMode:-

in the last version, pinMode order is 4,5,6,13 (logical)
In the void setup and void loop, the port order was 5, 6, 4, 13.
I have changed them all so that they match the pinMode order.

It is now easy to determine which sensor and strap relates to the outputs.

My file with new comments is attached.

Phil

Attached Files



#150 AstroShomy

AstroShomy

    Sputnik

  • -----
  • Posts: 26
  • Joined: 30 Nov 2012

Posted 22 January 2013 - 01:54 PM

I am so glad I have found this topic. I read all the posts once, and will read them a couple of more times, just to make sure I understand all that I need to do to make this controller. I hope I will get your help if needed. For start, I have ordered the Uno. It will arrive in two weeks. In the meantime, I will try to order other components, and then join the team :D

Thanks!






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics