Electrical Appliance control using JNI
Dear All,
I am fairly well of in java/jee. I love listening to music when I am coding. Last Sunday, I thought I should be able to turn on my stereo which is some distance away from my desktop, using my desktop ( and through a java program)... and suddenly I felt like falling in an abyss with the lack of knowledge of low level programming. Then I researched, and somebody advised I could write the actual code to turn on the appliance using C/++ and using JNI could call it in my java program. I coded in C/++ in my college (long time ago). I fail to understand, how actually, will the flow of this program move
heres how I thought it could have been : . I am a little weak in electricals. Still, for electricity to be supplied to the appliance there needs to be a "make" in the circuit. I guess, I will have to put up a controller (sort of a device) where one portion of it connects to the electric supply and the other to the television, and somehow have this wired to my computer (I dont know how, though) and then go about making and breaking the circuit. I am completely lost with this, I dont even know if what I know is right or wrong :( I would appreciate just about any help in this regard.
Thanks in advance for your time spent on this post.
# 1
I suspect you are going to want to do more than just turn it on.
But that is it then there is a class of electronics known as "home control"/"home automation" which provides various controllers primarily for turning things on an off. You can control those via a computer. You can find those at large hardware and electronic stores and online of course.
It is probably easier to just use an existing home controller app for this. Or alternatively use Runtime.exec() to run a command line tool.
If you want to control (not just turn on/off) your stereo it would be significantly more complicated. You would need a on board remote control and I have never seen one of those. Presumably someone could make one of those but it would take a lot of knowledge in electronics and construction (electronic) technology to do so.
Once you had one then it would have an API interface that you would code to.
# 2
Spot on dear jschell, what you said hit me this saturdaty. :-).
But then again, I thought I should be able to do something with the electrical appliances. Atleast turn on an electric bulb ( CFL ) /TubeLight.
Then, thoughts took a higher frequency, which I guess I will be able to give effort to, once I am able to turn on the electric bulb.
I am gonna google and look into the available existing home controller apps.
Still, any pointers as to how could I proceed at least with turning on an electric bulb ?
Thanks in advance for your time.
# 3
> Still, any pointers as to how could I proceed at
> least with turning on an electric bulb ?
In what direction? The stuff I referred to previously does that.
If you want to create your own electronics then you are going to need quite a bit of electrical knowledge. Plugging in a card into your PC that shorts it directly the wall outlet is an excellent way to need to shop for a new computer.
# 4
>directly the wall outlet is an excellent way to need to shop for a new computer.
LOL.... Thanks a ton for your help and patience, I will post back here very shortly with what I find out. The ultimate goal, of this exercise would be, to gain knowledge in electricals, and radio waves/infrared(?) (thats how I guess a remote control works ). Finally, have the remote control and the controller setup, wire it around the house ( seperating it with rooms ) and then gift this setup to an old age home. Lets see how far I can go. Solutions already exist in the market however, neither me nor the old people can afford it in my part of the country.
Cheers..
# 5
> Solutions already exist in the market however,
> neither me nor the old people can afford it in my
> part of the country.
Unlike the "good old days" you will probably find that sweat equity isn't going to translate into cost savings, particularly if you are just a beginner.
It is likely to cost more even for someone with experience.
# 6
Simple,
Write a driver for linux to control the com/parallel port...
http://www.freesoftwaremagazine.com/articles/drivers_linux?page=0%2C0
http://www.xml.com/ldd/chapter/book/
Write a java app that uses the driver.... As for electrically hooking up your com/parallel to other electronic components, you're on your own there.....
J.D.a at 2007-7-12 8:20:57 >

# 7
> Simple,
> Write a driver for linux to control the com/parallel
> port...
>
> http://www.freesoftwaremagazine.com/articles/drivers_l
> inux?page=0%2C0
> http://www.xml.com/ldd/chapter/book/
>
> Write a java app that uses the driver.... As for
> electrically hooking up your com/parallel to other
> electronic components, you're on your own there.....
I can only think that you didn't understand some part of the above discussion.
The hard part in the above is controlling the device not the interface to that controller.