With my limited knowledge I don't see anything wrong with your use of those pins for the sensors or for the LCD but using them for both purposes at the same time sets off alarm bells to me. Have you seen anything documented to say it is possible to share the pins in that way? It looks unlikely to me and I would avoid it if at all possible.
|
I agree that what I am doing is not correct, but I don't know how to write the sketch properly and to wire it so that the lcd pins use the digital pins on the Arduino and the analog pins on the Arduino are just used for the LM34 temp sensors. I need to do more research. Thanks.
|
As long as you're not physically wiring the pins together, the arduino software is smart enough to differentiate the digital pins from the analog pins. That shouldn't cause any issues. If you want to test it, just comment out your LCD code and disconnect the LCD.
Do you have a link to the relay shield you're using? Are there any known issues with it? |
Quote:
Agree about commenting out and disconnecting the LCD as a quick test. |
in post number 66, you define your sensor pins here:
Code:
int SsensorPin = 4; // the pin to read solar panel temperature Code:
#define SsensorPin 1//Arduino analog pin where the Sensor1 is connected if you want to keep them connected to the same pins, just change the 1 and 2 to 4 and 5. it should work better then. defining pin locations as variable integers is risky business. you want to define them as constants to prevent murphy's law. |
Thanks for the response. It does seem to add stability, but I am not sure why the #define function works better than the int function. I will dig in!
|
I found a small inaccuracy with the code today. I wasn't resetting the variable that is used to hold the sensor readings. So, for example, on the first run through it starts as 0, takes 10 readings, averages them to eliminate any noise over the lines. The second time through it reads that averaged number going into it, then adds 10 more values, then averages them. This definitely throws the true readings off. However, since its a differential controller, its not horribly important because both sensors will be off relatively the same amount. However, it is fixed now.
I've been having some issues with the attic fan not turning off like it should, so I've been troubleshooting. Here is the latest code. Code:
/* Thermal Differential Controller |
All times are GMT -5. The time now is 05:09 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger