This video is around Raspberry Pi to showcase the usage of Raspberry Pi in IOT projects and that’s using JAVA. This is going to be a series of video including Sensor interfacing using pi4J, REST API usage with JAVA, MQTT usage with JAVA and finally adding all to the same project and running over Raspberry Pi. So this video is going to be the first part of it where we will see how to interface DS18B20 one wire temperature sensor with Raspberry Pi by using JAVA with the help of the pi4J library. I will upload the rest of the videos in the series soon.
Code:
import com.pi4j.component.temperature.TemperatureSensor; import com.pi4j.io.w1.W1Master; import com.pi4j.temperature.TemperatureScale; public class WaterTemperatureSensor { public double getWaterTemperature(){ W1Master w1Master = new W1Master(); // System.out.println(w1Master); for (TemperatureSensor device : w1Master.getDevices(TemperatureSensor.class)) { // System.out.printf("%-20s %3.1f°C %3.1f°F\n", device.getName(), device.getTemperature(), // device.getTemperature(TemperatureScale.CELSIUS)); if(device.getName().contains("28-0115155154ff")) return device.getTemperature(TemperatureScale.CELSIUS); } return 0; } }
Links :
Github Repo: http://bit.ly/2sxXweP
Schematic: http://bit.ly/2qJ0M6x
I2C Communication on Pi: http://bit.ly/2jswlgD
16×2 LCD with Pi: http://bit.ly/2kgR7o8
Java Application on Pi Playlist: http://bit.ly/2eB1O2K
Schematic: http://bit.ly/2jsCadP
Download Pi4J Library: http://bit.ly/2j32blF



Developer, Tinkere, a proud Dad.. love to spend my available time playing with Tech!!