CRC16 using JAVA

CRC16 using JAVA

CRC codes are numerously used for error checking purposes. So many times working around Embedded Devices you will find CRC used in different communication protocols for error detection. This piece of code will help you to generate CRC16 using provided packets in JAVA. While working on devices like Raspberry Pi which supports JAVA and industrial protocols like MODBUS which uses CRC16, this code can be used.  

Read More

Install Zulu JDK on Ubuntu

ZULU JDK on Ubuntu

Recently I moved my server to Ubuntu from windows. I went with Ubuntu 16.04 server edition as it is lightweight as compared to desktop edition and comes preloaded with some server tools. As I am running OpenHAB for my home automation system I wanted to install it on the server but the server edition doesn’t come with JAVA/JDK pre-installed. As per OpenHAB, Zulu JDK is the recommended JAVA platform and performs better as compared to OpenJDK. Though Oracle JDK can be installed, I thought of trying ZULU. So let’s see…

Read More

Access Watchdog Timer of Raspberry Pi using JAVA

This tutorial is all about using the watchdog timer of Raspberry Pi by using JAVA. For this, we are going to use Pi4J library. Watchdog Timer: “A watchdog timer (sometimes called a computer operating properly or COP timer, or simply a watchdog) is an electronic timer that is used to detect and recover from computer malfunctions. During normal operation, the computer regularly resets the watchdog timer to prevent it from elapsing, or “timing out”. If due to a hardware fault or program error, the computer fails to reset the watchdog, the timer will elapse and generate a timeout signal.…

Read More

Firmata protocol with Raspberry Pi and Arduino

Firmata with Arduino and Raspberry Pi

Firmata is a protocol that is used to communicate with microcontrollers from any tablet/pc over the serial interface. There are implementations of this for other platforms too along with Arduino. You can find support for this if you are using any Arduino IDE released after 2008.Use of this protocol lets you access GPIO of Arduino from any host device natively without uploading the sketch each time you change the sketch. You can use Arduino as ADC for your Pi as it doesn’t have native ADC pins, you can also interface…

Read More

DHT12 Interfacing with Raspberry Pi using Pi4J

DHT12

This video around raspberry pi showing how to interface DHT12 humidity and temperature sensor with raspberry pi by using JAVA nad Pi4j. DHT12 its a temperature sensor with a 1-Wire and I2C interface to connect with external controllers and having 1-Wire interface makes it compatible with the older DHT11 sensor but with a higher accuracy. For this tutorial, we are going to use the I2C interface of the sensor and to interact with it, we will be using JAVA. One issue with the DHT12 I2C interface is that the device…

Read More

Run JAVA Applications on NanoPi S2

JAVA nano Pi

The NanoPi S2(S2) is designed and developed by FriendlyElec for professionals, enterprise users, makers, and hobbyists. It is a small board with WiFi, Bluetooth, and eMMC. It uses the Samsung Quad Core Cortex-A9 S5P4418 SoC with dynamic frequency scaling up to 1.4GHz. It has 1G DDR3 RAM, 802.11 b/g/n WiFi & Bluetooth 4.0 module. Its inbuilt power management unit uses the AXP228 chip which supports software shutdown. It takes power over the MicroUSB port. It has video input/output interface, 3.5mm audio jack, USB port, and MicroSD card slot, serial debug…

Read More

Measure Distance using Ultrasonic Sensor HC – SR04 | Pi4J | JAVA | Raspberry Pi

uLTRASONI pI

This is a simple tutorial showing how to interface HC – SR04  ultrasonic ranging module with Raspberry Pi to measure distance using JAVA. Ultrasonic ranging module HC – SR04 provides 2cm – 400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules include ultrasonic transmitters, receiver and control circuit. The basic principle of work: (1) Using IO trigger for at least 10us high-level signal, (2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back. (3) IF the signal back, through…

Read More

Thermocouple Interfacing usng MAX31855 | Raspberry Pi

Thermocouple Interfacing usng MAX31855 | JAVA & Pi4J| Raspberry Pi

Reading thermocouple data on Raspberry Pi using JAVA and Pi4J with the help of MAX31855 14 bit thermocouple to digital converter. The MAX31855 performs cold-junction compensation and digitizes the signal from a K-, J-, N-, T-, S-, R-, or E-type thermocouple. The data is output in a signed 14-bit, SPI-compatible, read-only format. This converter resolves temperatures to 0.25°C, allows readings as high as +1800°C and as low as -270°C, and exhibits thermocouple accuracy of ±2°C for temperatures ranging from -200°C to +700°C for K-type thermocouples. Source : MAXIM Integrated(bit.ly/2i3GvZ4)  …

Read More

Bit Stuffing Code Implementation in Java

programming

This is an implementation of the Bit Stuffing popularly used in data communication, also known as one of the concepts of Framing data bits. Bit stuffingis the process of inserting noninformation bits into data to break up bit patterns to affect the synchronous transmission of information. It is widely used in network and communication protocols, in which bit stuffing is a required part of the transmission process.To know more please click here.    Sample Output: This is a sample output with data binary data entered as 11001111110. Code: import java.util.*; public…

Read More

A simple program to check anagrams in java

programming

This is a simple program in Java. This program can be used to check if the two given strings are anagram. Two given strings are said to be anagrams when they have equal length and same characters are present in both the Strings. An example of anagram strings is SILENT and LISTEN! Screenshot Code import java.util.*; public class Anagram { public static boolean isAnagram(String s1, String s2) { if (s1.length() != s2.length()) { return false; } s1 = sortCharacters(s1); s2 = sortCharacters(s2); return s1.equals(s2); } public static String sortCharacters(String str)…

Read More