balkishore Geschrieben December 11, 2012 at 19:34 Geschrieben December 11, 2012 at 19:34 Dear users, I am pretty newbie in sensor technology. I have a light bricklet attached to my brick. All i know is, the bricklet would measure light in luminance. I have a webserver running on my localhost port 8080 and aslo I have a mongodb database(a noSQL JSON based database). All I want to know is, how can I measure light and save the value into a http link and send a http request to my webserver. Is it possible to achieve this in tinkerforge? I would prefer coding in Java. Any help would be really appreciated. Thanks a lot in advance. Zitieren
photron Geschrieben December 12, 2012 at 09:24 Geschrieben December 12, 2012 at 09:24 Sure, this is possible. You have two somewhat unrelated problems/tasks here: [*]Getting the illuminance value from the Ambient Light Bricklet [*]Writing the illuminance value into your database For the first task you can find example code in our API documentation: http://www.tinkerforge.com/doc/Software/Bricklets/AmbientLight_Bricklet_Java.html For the second task your Java program gets the illuminance value from the Ambient Light Bricklet and sends it to your webserver. How this is done in detail is up to you. Zitieren
Anton Geschrieben December 12, 2012 at 14:28 Geschrieben December 12, 2012 at 14:28 I have actually done this for my home automation project i'm working on. Though I use a MySQL DB. My setup is roughly like this: Server running MySQL and my Java Application. The Java App handles communication with both my TinkerForge devices and MySQL DB. The Java App 'listens' on my DB for any changes. So say a light goes from the value '0' to '1' it turns that relay switch on. That way i can access my system from anywhere if i want to in the future. It is also easy to make a webpage or an iPhone app to control the system via the DB. Right now i have a raspberry pi connected to Tinkerforge via wifi so that i can place it where ever i want to. Unfortunatly the cost of a Masterbrick+wifi extension + power supp + relay bricklet is too much, so i'm looking into using xbee modules as well. Maybe using the IO bricklets to control and send messages to the xbees' with. I would recommend using a SQL DB it is much easier to communicate with other devices that way and controlling out site of your network. Zitieren
balkishore Geschrieben December 12, 2012 at 20:10 Autor Geschrieben December 12, 2012 at 20:10 Thanks a lot for reply guys! I would look out for various options. Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.