EcoRenovator

EcoRenovator (https://ecorenovator.org/forum/index.php)
-   Appliances & Gadgets (https://ecorenovator.org/forum/forumdisplay.php?f=21)
-   -   Price-sensitive device controller (https://ecorenovator.org/forum/showthread.php?t=3894)

SDMCF 10-01-14 01:08 PM

Price-sensitive device controller
 
At AC's request, here is a new thread about my controller project.

Copied from the "DIY Sous Vide Temperature controller" thread:

Quote:

Originally Posted by AC_Hacker (Post 40840)
Quote:

Originally Posted by SDMCF (Post 40835)
This is interesting to me because I am working on a temperature controller with design goals that are very different but maybe the hardware could be similar. You want a constant temperature and I want to control or even promote temperature fluctuations.

Initially I am controlling my freezer temperature. Our electric tariff is linked to the wholesale electricity price. This varies hour by hour, with the prices for each hour of each day published on the web around midday the previous day. My controller will grab these prices from that web page and then control the device(s) to minimise costs. So the freezer will run to a lower temperature when electricity is relatively cheap, and allow the freezer to warm up (but still keep it "cold enough") when prices are high. Eventually I hope to apply this approach to control other things, not necessarily temperature-related. Mainly for geek-appeal rather than in anticipation of huge cost savings.

I am creating my own controller based on an Arduino because I couldn't find anything off-the-shelf that I could easily modify for this purpose. When you were searching for a controller did you find any with an internet connection? Or any way of externally (programatically) setting the required temperature?

This is a really fiendishly clever and geeky project. I envy Finland for having daily energy information available for purposes such as you are engaging in. And I admire you for wanting to tackle a DIY project that will optimize energy use by using that information.

Regarding Ethernet connectivity, there are Ethernet shields available for Arduino boards.

In fact, HERE_ARE_SOME for about $10 US.

This looks to be an awesome project, please start a new thread for this and keep us informed of your work (lots of photos, code, etc.).

Depending on how deep or long you want your cycles to go, you might want to consider Phase Change Material (PCM) to chemically store and release energy, at a temperature below your sub-freezing set point.

I have discovered that large pharmacies receive shipments of vaccines in high-quality foam containers and they use PCM material for the duration of the shipping. I have asked for some of the PCM, and they have happily given it away for free... of course, I did flirt with the beautiful girl at the pharmacy counter, which never hurts when you are looking for free Phase Change Material.

Also, it is quite apparent to me that you, SDMCF, are a totally driven energy geek. There is no known cure for this condition, except even geekier projects.

Therefore, you may have SEEN_THE_PROJECT that used Vacuum Insulated Panels (VIP) to build a high efficiency, low energy loss door... If you wanted to ascend to even higher levels of geekhood, you might consider ripping out the outmoded insulation from inside your existing freezer, and replacing it with vacuum panel insulation.

Combining VIP insulated freezer with PCM and a DIY web-based Smart Energy Controller would assure you, SDMCF, a permanent place of admiration in UberGeekWorld.

Good Luck!!

-AC


SDMCF 10-01-14 01:09 PM

I have made a start on the project, so this post is a description of what progress I have made so far. Let's start with the hardware.

The guts of the controller is an Arduino. I have bought a mega and an uno and I don't know yet which I will use. This is my first Arduino project so I am learning as I go.

I will use 1-wire temperature sensors. Initially I have been testing with two of these, one for a freezer and one for a fridge. I bought a few more in case I think of other applications.

For the internet access I will use an Ethernet shield.

To switch on & off the power for the controlled device(s) I will use a relay board. I have boards with 2, 4 and 8 relays. They are all basically the same, so I can use any of them, depending on the number of devices I decide to control.

To log temperatures and relay actions etc I will use the SD card on the Ethernet shield.

To provide a user interface I will using an LCD display. I bought some that were originally intended for Nokia 5110 GSM phones. Not very fancy but workable and cheap.

For configuration and a more sophisticated user interface I will create a web page for the controller which I can access with a browser.

I have a real time clock board so the controller knows the time of day.

I think that is about it for the hardware I have obtained so far. I would like to add hardware to measure the current used by the controlled device(s) but I have not given enough thought to that yet.

The approach I am taking to the software is to split the task into smaller sub-tasks and test each of these individually. When I have proven each one I will combine them into a single sketch. So far what I have working is:

Temperature reading with the 1-wire sensors. I can read the temperatures from multiple sensors on the same 1-wire bus.

I can log the temperature settings (or anything else I guess) to a text file on the SD card. I will create a new file for each day. I haven't yet finalised the layout of the text file.

I have tested output to the LCD. I have put the current temperature on a web page which I can view from any PC on my home LAN. (I have tested using a dynamic DNS service to make this data available over the internet, but I don't see any reason to do that in the final version). I have not yet tried any configuration settings via this web page.

I am able to set the time of day on the real time clock by checking the time on an internet NTP server. I can find the UTC time and I can add an offset for my timezone, but there is one bit for which I don't yet have a solution. I don't know how the controller can discover whether summer time is in operation, so I could be an hour wrong with the time I set.

I am able to switch relays on & off, with LEDs to indicate which relays are on.

At the moment I am working on getting electricity price data from the internet at Market data | Nord Pool Spot
As a native speaker of Pascal rather than C++ I have prototyped this using Delphi on a PC. I now have to port the code to C++ on the Arduino.
The web page gives the bulk price of electricity on the spot market, in euro per mWh. My price per kWh is the bulk price plus a fixed markup. I could convert the published price to my price but I don't think I need to. I am interested in the relative price at different times of the day, not the absolute price, so I can use the raw published data and don't need to change anything if the markup ever changes.

Summary: I think I am well on the way to understanding everything required for this project and I have proof-of-concept code for most of the individual elements of it. Soon I will start adding these building blocks together to create a full working controller. At that stage I can provide some photos and code.

Ormston 10-07-14 02:29 PM

This is the easiest method I've found for measuring power with arduino.
The library does all the measurements and calculations for you.

CT sensors - Interfacing with an Arduino | OpenEnergyMonitor

Steve

bmxeroh 10-07-14 03:30 PM

With all of the hardware you're running, make sure to consider where you are pulling power from. For example I don't think the arduino being powered via USB can provide enough power to drive one of the 8-channel relay boards through the 5v rail. If you consider the LCD, and Ethernet shield as well you would be better off using a standalone power supply to ensure you don't stress the on board regulator. I doubt you want to buy a new one 5 minutes after you get everything connected up.

Servicetech 10-07-14 09:08 PM

Does your energy provider offer any devices that will do this automatically? I have a Thermostat that talks to my power meter, when the rate changes I tell it how much less I want to run the AC. Best of all the thermostat was FREE (including installation) for signing up for the variable price plan.

OGE: SmartHours
Carrier ComfortChoice

SDMCF 10-08-14 12:31 AM

@Ormston: Many thanks for that. I hadn't seen it before. I will study it. I had been thinking of something like that or alternatively something like this. The ready-made library for the approach you suggest is a big bonus though so I will probably go that way.

@bmxeroh: Good point. I was aware of this and I have a suitable power supply for both the Arduino and seperately for the relay board, plus a step down from 5V to 3,3V to suit the LCD. In operation the controller doesn't use USB power at all, and is only connected to a PC for development.

@Servicetech: No, our energy provide doesn't provide anything like that, unfortunately. It sounds like your provider is more switched on (pardon the pun) and your meter is more sophisticated. Our meter doesn't know the rate so I have to get that data from the internet. How do you tell your device how much you want to run the AC? Is that a manual process or programmable? How often does your rate change?

Ormston 10-08-14 01:36 AM

SDMCF

You could use the bi directional version Pololu - ACS714 Current Sensor Carrier -30A to +30A as I'm assuming it's AC you need to measure and control.
This could be used with open energy's library. Hookup should be identical to using a CT and change the calibration value to suit 30A sensor instead of 100A

Steve

SDMCF 10-08-14 01:44 AM

OK, That makes sense. Thanks for the tip.

Mikesolar 10-08-14 05:53 AM

Quote:

Originally Posted by Ormston (Post 40970)
SDMCF

You could use the bi directional version Pololu - ACS714 Current Sensor Carrier -30A to +30A as I'm assuming it's AC you need to measure and control.
This could be used with open energy's library. Hookup should be identical to using a CT and change the calibration value to suit 30A sensor instead of 100A

Steve

Hmmm, wonder if there is a clamp on version that does 100A +-. I had thought about keeping generated current going to the grid only until it reaches parity, then charging the battery with the excess. One place I am working has a meter that will not reverse so if you pump power to the grid it still counts it as consumed energy and the customer gets charged......Trying to find a way around it.

Servicetech 10-08-14 06:05 AM

Quote:

Originally Posted by SDMCF (Post 40969)
@Servicetech: No, our energy provide doesn't provide anything like that, unfortunately. It sounds like your provider is more switched on (pardon the pun) and your meter is more sophisticated. Our meter doesn't know the rate so I have to get that data from the internet. How do you tell your device how much you want to run the AC? Is that a manual process or programmable? How often does your rate change?

Your meter MUST be able to report use based on time of day back to the utility. Thats the only way and Time of Use/Variable Peak Pricing system can work. Old analog meters are incapable of reporting peak and off peak use separately. Smartmeters send a signal to OGE reporting use every 15 minutes. Our utility shares the use data with the consumers on myogepower.

See Smarthours link posted about for how the rate changes. It increases from 2-7pm weekdays during the summer. The thermostat is programmed to go up 0-10 degrees for each rate increase. I have my thermostat set at 75f for 6 cents, 77f for 10 cents, 79f for 19 cents, 85f for 43 cents. Rate response completely consumer adjustable.

SDMCF 10-08-14 10:48 AM

Quote:

Originally Posted by Servicetech (Post 40974)
Your meter MUST be able to report use based on time of day back to the utility.

Yes, my meter knows how much I use (and reports that to the utility company) but it doesn't know how much that usage will cost me. I need to get cost information from the internet.

It sounds like your prices are less volatile than mine. Mine changes on the hour, every hour, in an unpredictable manner.

jeff5may 10-08-14 10:55 AM

Im working on a sketch for a universal heat pump and temperature controller in another thread. I'm having issues with the way to read and store multiple one wire sensors. Can you elaborate on the method you're using? I'm trying to save as much memory as possible.

Ormston 10-08-14 01:46 PM

Quote:

Originally Posted by Mikesolar (Post 40973)
Hmmm, wonder if there is a clamp on version that does 100A +-. I had thought about keeping generated current going to the grid only until it reaches parity, then charging the battery with the excess. One place I am working has a meter that will not reverse so if you pump power to the grid it still counts it as consumed energy and the customer gets charged......Trying to find a way around it.

The BI Directional requirement is because it's AC current, has nothing to do with import/export.

The library I mentioned does measure import/export using a single 100A ct exactly as you need, to do this it also needs to measure the voltage using a AC/AC transformer at the same time.
If you look round openenergymonitor.org you will find people have built solar diverters.

Steve

SDMCF 10-09-14 02:00 AM

Quote:

Originally Posted by jeff5may (Post 40985)
Im working on a sketch for a universal heat pump and temperature controller in another thread. I'm having issues with the way to read and store multiple one wire sensors. Can you elaborate on the method you're using? I'm trying to save as much memory as possible.

If you are trying to save as much memory as possible you are probably more advanced than I am because I am not concerned with optimising anything yet. So I can't claim any memory efficiency for my code.

I tried (and failed) with a couple of different approaches to the 1-wire stuff before I found Arduino 1-Wire Tutorial which I was able to use.

The libraries I use are OneWire.h version 2.1 and DallasTemperature.h version 3.7.2

A sketch called Multiple.ino supplied with the DalasTemperature library works as expected with 0, 1 or 2 sensors. I have not tried using more than 2 sensors.

The supplied sketch has hard-coded device addresses which is not ideal, but it will get you started.

I am currently using code that finds the device addresses and resolutions of all sensors attached to the 1-wire bus, which is better. I can post that code at the weekend if you want it.

However, I still have the names of my devices hard-coded, so I have to know which one will be found first in order to correctly identify them as fridge or freezer. Eventually I will make it possible to assign temperature sensor locations via the user interface, but I am not at that stage yet.

jeff5may 10-09-14 06:28 PM

Due to the low pin count and onboard memory of the Uno, doing anything really elaborate with the data structure or interface will quickly gobble up all available memory. I'm trying to save RAM for the processor, buffers, and temporary variables as much as possible to avoid ugly things from happening. Plus, it saves more space for vital functionality and expansion later.

The controller, being universal and robust, should be able to find and track as many one wire sensors as the end user cares to connect. I am having no trouble with only one sensor, but with multiple sensors, I am looking for some code that can grab the addresses and data and write the values to an array or a matrix or something. Once the values are sorted and written somewhere, it will be easy for me (or someone smarter) to assign, log, display, and do other operations to them.

Any code you can post or link to would be highly appreciated.

What I'm finding in this (arduino) realm is just a google of snippets of code that call other modules or libraries to do most of the actual work. While this approach is OK for a device that only does one or two things, it's not very robust. It also ties up a whole lot of real estate on the chip, making the program run slower.

SDMCF 10-09-14 11:45 PM

Quote:

Originally Posted by jeff5may (Post 41001)
I am having no trouble with only one sensor, but with multiple sensors, I am looking for some code that can grab the addresses and data and write the values to an array or a matrix or something.

I have code that does this. I will post it later today or tomorrow when I am at home, but ...
Quote:

What I'm finding in this (arduino) realm is just a google of snippets of code that call other modules or libraries to do most of the actual work. While this approach is OK for a device that only does one or two things, it's not very robust. It also ties up a whole lot of real estate on the chip, making the program run slower.
I prefer to take the library approach. I guess our goals are different. I know how much work it takes to create custom code that is as robust as a reputable library, and I am not particularly constrained by chip real estate or speed. For me the library approach makes sense.

AC_Hacker 10-10-14 01:22 AM

Quote:

Originally Posted by jeff5may (Post 41001)
Due to the low pin count and onboard memory of the Uno, doing anything really elaborate with the data structure or interface will quickly gobble up all available memory. I'm trying to save RAM for the processor, buffers, and temporary variables as much as possible to avoid ugly things from happening. Plus, it saves more space for vital functionality and expansion later.

The controller, being universal and robust, should be able to find and track as many one wire sensors as the end user cares to connect. I am having no trouble with only one sensor, but with multiple sensors, I am looking for some code that can grab the addresses and data and write the values to an array or a matrix or something. Once the values are sorted and written somewhere, it will be easy for me (or someone smarter) to assign, log, display, and do other operations to them.

Any code you can post or link to would be highly appreciated.

What I'm finding in this (arduino) realm is just a google of snippets of code that call other modules or libraries to do most of the actual work. While this approach is OK for a device that only does one or two things, it's not very robust. It also ties up a whole lot of real estate on the chip, making the program run slower.

This guy made an open source Arduino data-logger which would handle multiple 1-wire devices.

Perhaps his source code could be useful for this project.

-AC

jeff5may 10-13-14 11:00 AM

SDMCF,

Yes, if I was using a mega with a few additional shields, it would be much easier. In a future project, this might happen. For this project, a uno with hardly nothing else is specified. Very few libraries, an LCD keypad for user control, optional USB/serial interface, a 4-channel relay shield to manage high-power devices, and some sensors is all this controller will have in its basic form. The main objective is to specify a small "kit" to work with, and have some sketches that will just load and work.
http://ecorenovator.org/forum/attach...-gpc-parts-jpg

As a matter of fact, someone has already mentioned counting power pulses from smart meters (via the visible flashing LED) to monitor usage as dependable and reliable. Just search and browse....

AC,

Thank you very much for pointing me towards that code! I've heard you talking about that little logger stamp before, but I didn't know it was able to assign and store 1-wire sensors like it does. Having skimmed through the source code, I believe I can adapt some gems in it for the uno-based stamp. From the structure and comments, it's obvious a lot of work was put into the source code. I hope I can glean something from it without screwing it up...

SDMCF 10-18-14 07:22 AM

Sorry, been away. Expected to be back last Saturday but was only home for a couple of hours before rushing out again, so here I am a week later. Should be static for a while now. Do you still want a look at my sensor code? I'll put it up if so.

I had seen stuff about monitoring the flashes from the meter to count electricity usage. It sounds nice and I have bought a sensor to try that sometime, but it isn't what I want to do in this project. Here, I just want to monitor the power used by the devices which my controller controls, rather than all the power used in the house.


All times are GMT -5. The time now is 11:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger