Control power of another electrical device via software
8 replies, posted
Hello,
Apologies if it's in the wrong place, this seemed the best place to put it.
Anyway, I'm looking to help out a friend who owns a sunbed business and I'm looking for a way for me to program a piece of software that allows the staff to turn the sunbeds on and off by the program I will create. I have no problems creating the program, the problem I'm going to run into due to me not having a clue is what hardware device could I possibly use that will connect the computer and the sunbed and allow the computer to either remotely or wired control the power on or off.
As well as this, whatever the hardware I will need to be able to access it via a custom made program.
So does anyone have any suggestions?
Relay controlled by parallel port or an arduino or something?
ATMega328p and an FT232R.
Flash the ATMega328p with the Arduino Uno bootloader, and then program with the Arduino environment.
Sounds good, however I'm unfamiliar with these, also is there a way a C# program can communicate to said device?
Edit:
Also how could I connect this to a sunbed?
I'm guessing that sunbed takes standard 230V AC?
There's readymade devices to do this - smart plugs. They connect over WiFi or Ethernet and usually offer a webinterface, which you should be able to control programmatically.
Might be a bit more expensive than building your own, and the network security could be problematic (i.e. it's possible anyone on your network could be able to turn the thing on and off), but it's a lot easier (and safer than handling mains electricity).
[url]https://stackoverflow.com/questions/1243070/how-to-read-and-write-from-the-serial-port-in-c-sharp[/url]
You have C# on a computer, that talks over serial to the microcontroller, which is running something you wrote in C or C++ (or Assembly, but that's a big unnecessary), to take in input and then does whatever you've programmed it to do.
Connected it to the sunbed, depends entirely on how much you want to interact with the sunbed.
If you just want to connect or disconnect it from the AC mains, you can do it with relays.
Anything more fine than that, you'd need to either find an IO port on the sunbed you can interact with, or take it apart and reverse-engineer it a bit.
[QUOTE=DrTaxi;47726055]I'm guessing that sunbed takes standard 230V AC?
There's readymade devices to do this - smart plugs. They connect over WiFi or Ethernet and usually offer a webinterface, which you should be able to control programmatically.
Might be a bit more expensive than building your own, and the network security could be problematic (i.e. it's possible anyone on your network could be able to turn the thing on and off), but it's a lot easier (and safer than handling mains electricity).[/QUOTE]
This is probably the easiest way to go about it, i wouldn't try to come up with a custom solution.
You can have a quick google if the smart plugs in questions have an API you can use from C#, if it doesn't you can probably just hack in an API using http calls.
edit: [url]http://www.msilverman.me/2014/01/interfacing-with-remote-controlled-outlets/[/url]
I like this solution, it would be very easy for my program to interact with a web interface, thanks for all the solutions!
Edit:
After reading the above solution, would this work for multiple sunbeds? And due to it being wireless which is great, would it have enough signal strength to receive information through floors and walls?
Edit edit:
So I've found a nifty plug socket that supports wifi, has a web interface and has an API which is great, my next problem would be knowing which plugs I'm switching on or off. Does anyone have any better ideas?
Just an FYI. In the UK, im 99% sure that its ilegal for people to modify/create electrical goods that connect in someway directly to the mains without being an electrician. So its likely to be ilegal to use an arduino relay to connect a 240v sunbed to the mains.
You might as well just buy a power plug and interface with it using an arduino.
Sorry, you need to Log In to post a reply to this thread.