Mosquitto MQTT Publish – Subscribe from PHP

Looking for the code to connect to Mosquitto broker from your PHP code ? Here's a simple example with step by step instructions. The complete functional code can be downloaded here. Before starting off, you need to have php, Mosquitto broker and Mosquitto library for php installed. If you need guidance on installing Mosquitto library for PHP, do refer my instructions here. The Basic PHP page Let’s start from a simple PHP web page. Our page has only two buttons - one to publish and one to subscribe. Below php file is saved…continue reading →

Linear Correlation, Measures of Correlation

KTU: ME305: COMPUTER PROGRAMMING & NUMERICAL METHODS | Module VI: Curve fitting: Linear correlation, Measures of Correlation.| Correlation refers to the degree of relationship between two variables. Read more...

Mosquitto PHP library on RaspberryPi – Installation

To connect to Mosquitto MQTT broker from your PHP code, you need to have the Mosquitto PHP library module enabled on your server. This post explains steps to get the Mosquitto PHP library installed. These steps have been verified on Ubuntu desktop as well as on RaspberryPi (Raspbian Jessie), running Apache2 and PHP 5.4. You need to be connected to internet to complete these steps. Follow them in the order given. 1. sudo apt-get install php-pear 2. sudo apt-get install php5-dev 3. sudo apt-get install libmosquitto-dev 4. sudo pecl install Mosquitto-alpha NOTE: In…continue reading →

Curve Fitting – Method of Least Squares

KTU: ME305: COMPUTER PROGRAMMING & NUMERICAL METHODS | Module VI: Curve fitting: Method of Least Squares - Non-linear relationships, Linear correlation.| Curve Fitting is the process of establishing a mathematical relationship or a best fit curve to a given set of data points. Read more...

Aitken Technique for Interpolation

KTU: ME305: COMPUTER PROGRAMMING & NUMERICAL METHODS |Module: V: Interpolation.| Aitken technique can be easily implemented in a computer program and hence is a popular interpolation technique. Read more...

Errors and Approximations in Numerical Methods

KTU: ME305 : COMPUTER PROGRAMMING & NUMERICAL METHODS | Module: V: Errors and approximations, Sources of errors. | In a numerical process, errors can creep in from various sources. Read more to understand how various errors arise, progress and impact accuracy...
TFT LCD Display shield for Arduino UNO

TFT LCD Display shield for Arduino UNO

This note is an introduction to the 2.4” TFT LCD Display shield for Arduino UNO. Items Used: Hardware Arduino UNO 2.4” TFT LCD touchscreen shield A computer USB cable to connect Arduino to the computer Software Arduino IDE : arduino.cc/Downloads This TFT LCD display can display colour graphics and is a touch sensitive screen. It has an SD card slot too for storing images. This display board can be inserted directly on to the Arduino pins, without using any wires. That’s why it is called a shield.  We can program Arduino to show graphics,…continue reading →

Solved Problems – Baye’s Theorem

Q1. There are three bags. First bag contains 1 white, 2 red and 3 green balls. Second bag contains 2 white, 3 red and 1 green balls. Third bag contains 3 white, 1 red and 2 green bals. A bag is chosen at random and 2 balls are drawn from it. These are found to be 1 white and 1 red. Find the probability that the balls so drawn came from the second bag. Solution: Let A1 be the event of choosing first bag Let A2 be the event of choosing second bag…continue reading →

Baye’s Theorem

Bayes theorem - Also known as Theorem of Inverse Probability Let A1,A2,...An be a set of exhaustive and mutually exclusive events of the sample space S with for each i. Let E be any event in S. Then Proof We have Therefore, Therefore,continue reading →