How to Measure temperature with Arduino and DS18B20 sensor?

In this example project we will be combining an Arduino and DS18B20 sensor. The DS18B20 is also called 1-wire digital temperature sensor

Arduino and DS18B20 Temperature Sensor The DS18B20 comes in different forms and shapes, so you have plenty of choice when deciding which one works best for you. There are 3 variations available: 8-Pin SO (150 mils), 8-Pin µSOP, and 3-Pin TO-92.

I have used waterproof version as shown below.

ds18b20-waterproof

Note: DS18B20 is quite versatile. It can be powered through the data line (so called “parasite” mode, which requires only 2 wires versus 3 in normal mode), it operates in a 3.0V to 5.5V range, measures Temperatures from -55°C to +125°C (-67°F to +257°F) with and ±0.5°C Accuracy (from -10°C to +85°C). It converts a temperature in 750ms or less to a up to 12 bits value. Another cool feature is that you can connect up to 127 of these sensors in parallel, and read each individual temperature.

Things you need to get Arduino and DS18B20 sensor work:

  1. Arduino IDE to program the code and upload
  2. OneWire and DallasTemperatre library for the Arduino and DS18B20
  3. One DS18B20 digital temperature sensor
  4. Arduino UNO R3
  5. Jumper wires
  6. Breadboard/PC/General purpose board
  7. Arduino UNO cable

Below is the schematic diagram for the same.

Schemaic_arduino_ds18b20_temperature_sensor

 

 

Step 2: Installing and loading OneWire and DallasTemperature Library

Unzip the downloaded zip file. Make sure that folder name is OneWire, which contains the library. Drag it into the Library folder of Arduino IDE. Alternatively you can use Sketch-> Import Library -> Add Library option of Arduino IDE and select the Zip file.

Step3: Writing code and uploading

#include<OneWire.h>
#include<DallasTemperature.h>

// Data wire is plugged into digital pin2
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);
void setup(void)
{
 Serial.begin(9600);
 Serial.println("Temperature Demo");
 sensors.begin();
}

void loop()
{
 Serial.print(" Fetching temperature...");
 sensors.requestTemperatures(); // send command to get temperatures
 Serial.println("Done..");
 Serial.println("Temperature is ");
 Serial.println(sensors.getTempCByIndex(0));
 delay(1000);
}


Output will be shown as follows:

Arduino DS18b20 - Output

Screenshot of the above example:

Arduino and a DS18B20 sensor 1

We can modify this to display it in LCD display. For details on how to display the temperature on LCD display visit my post How to connect 16*2 LCD display Arduino UNO

How to test Arduino UNO

C:\Users\Pintu\OneDrive\Blogs\Electronics\Adrino_UNO_image.png

You have received your Arduino UNO and want to quickly verify and test arduino uno that it is in good condition or you want to write your first Arduino UNO program. To do so you need to follow the following steps:

  • Launch the Arduino IDE. If you have not installed, you can download from following site and install it.

https://www.arduino.cc/en/Main/Software

  • Connect the Arduino to USB port.
  • Write the following code to blink the on board LEDtest arduino uno 1
  • Compile and upload the code.
  • The on board LED should start blinking every second.

 

How to transfer domain hosting and domain

There may be situation when you may require to transfer domain hosting from one hosting provider to other. Doing so there are many challenges like making sure that there is minimum downtime such that end user does not get to know that there is any change. To do so follow the following steps in order.

Steps to transfer domain hosting are detailed below:

Step 1 – Backup

Yes, backup everything: Files, database, email settings and all other things that you think is required later to restore in case anything goes wrong.

To backup database, you can use any WordPress plugin( if you are using WordPress) or you can directly go to CPannel to backup everything. Download all your backups on to your local system.

Step 2 – Copy all files to your new host

If you have downloaded all your files in step one, use same to upload it on the new host server.

Note: If you have a dynamic site, you may need to restrict some behaviour for some time or set a read only mode to prevent data being lost during the transfer.

If you are using WordPress then you first install WordPress in your new host. After that Restore database. Then copy all your contents: Plugin, themes and upload folders.

Step 3 – Testing

Test the the copy worked correctly.

Step 4 – Update old DNS system to point to new server

Change the old DNS system to point to the new web server and check the site is loading. At this point if everything goes fine you can re-enable full dynamic behaviour.

If you find any issue revert the DNS settings and fix all issues.

Note: Perform this step during the time when it is least used.

Step 5 – Update/Copy DNS settings in new server

Copy the DNS settings from the old server to the new hosts DNS server

Step 6 – Check the site works

Test the new site for all links working, images are loading fine and so on. Wait a few days for everything everywhere to propagate to the new settings, and then turn off the old nameserver.

Step 7 – Transferring Registrar ( This should be last step)

Raspberry Pi XBMC Media Center

In this project I will let you know steps to make your own Raspberry Pi XBMC Media Center.

Parts Required
The parts you will you need for this project are listed below. You will probably only need a USB keyboard and mouse for the setup after this you can remotely control XBMC (Kodi) via a tablet and/or web browser.

  • Raspberry PI
  • 4 GB SD Card (8 GB+ Recommended) or Micro SD Card if you’re using a Raspberry Pi B+ or 2
  • USB Keyboard
  • USB Mouse
  • HDMI Cord

Optional Item: Ethernet Cord or Wifi dongle

Step1:

Choose an operating system to install onto the Pi. Note: If you have a Raspberry Pi 2 please use OpenElec instead of Raspbmc. (You can follow the same steps but download the OpenELEC image instead of Raspbmc)

Raspbmc

 

Raspbmc

Raspbmc runs a full version of linux underneath XBMC but because of this it is slightly slower to boot up and the interface is somewhat slower when compared to a lighter weight version such as Xbian and OpenElec.

I found this the easiest to install and doesn’t require much work to have it working perfectly. You will need to tweak it a little to get the best out of it though. This is the most popular out of the three versions.

Find out more over at the Raspbmc website. Note: Raspbmc has now been discontinued please use OpenELEC instead.

OpenELEC

OpenELEC is a very light weight simple media center for the Raspberry Pi. The pro and con for this one is that the Linux OS underneath is virtually nonexistent. This allows for much faster boot times and just faster performance overall.

The biggest drawback on this is there is little to no room to move in terms of adding new drivers etc. If you do need to this then it will require an entire rebuild of your Pi.

This is great if you have technical skills and don’t require anything else but the standard drivers for XBMC (Kodi)

Xbian

xbian

Xbian much like OpenELEC is very light weight and fast but is much easier to install and configure than OpenELEC. This has everything Raspbmc has and is virtually identical. Xbian tends to get a lot of updates which means you get some minor features before the other two variations of XBMC.

This is perfect for anyone who wants faster updates but apart from that it is basically the same as Raspbmc.

Step 2

Installing Kodi (XBMC) Onto the SD Card

There are two ways to install Raspbian unto the SD Card the first two methods require a network connection to the Raspberry Pi. If you don’t have this luxury then simply follow my guide using the offline image.

Install via NOOBS (Network Connection Required)

Follow my earlier post How to install NOBS for Raspberry Pi for this.

 Install via OpenELEC Image

  1. Download the OpenELEC Project SD Card Image from the Raspberry Pi website.
  2. You will need a formatting tool. Download SD Formatter 4.0 for either Windows or Mac.
  3. Follow the instructions to install the formatting software.
  4. Insert your SD card into the computer or laptop’s SD card reader and check the drive letter allocated to it, e.g. G:/
  5. In SD Formatter, select the drive letter for your SD card (eg. G:/) and format

Install the OpenElec Image onto the SD Card

  1. Download and install the Win32DiskImager.
  2. Unzip the OpenElec image file so it will be .img and not img.gz (7zip is useful for this)
  3. Launch the Win32DiskImager and select the OpenElec ISO file and also the drive letter your SD card is assigned (Eg. G:/)
  4. Confirm you have the correct details and click on Write.

win32diskimager1

The Boot up

  1. Plug in all your necessary equipment into the Pi. (Keyboard, mouse,power supply and WiFi adapter(optional))
  2. Turn the Pi on by plugging in the micro USB cord from the power supply. It will now boot and spend about 5-10 minutes getting everything set up.
  3. Now it is all done and ready to go but if you would like to setup network and access files then go onto the next the section.

How to configure Visual studio load test Database manually?

To configure Visual studio load test Database manually perform following steps:
  1. Open a Visual Studio Command prompt. Type the following text: On a 32-bit version of Windows type: cd “c:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE” -or- On a 64-bit version of Windows type: cd “c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE”
  2. In that folder, type the following text:
    • SQL Express: SQLCMD /S localhost\sqlexpress /i loadtestresultsrepository.sql
    • SQL: You can install the database to any existing SQL server. For example, if you had a SQL server named Server1 you would use the following command: SQLCMD /S Server1 -i loadtestresultsrepository.sql

Caution The parameters are case sensitive. You must type uppercase S and lowercase i. SQLCMD /S pintu-home -i loadtestresultsrepository.sql

You might also need to specify a user name and password so that you can connect to Server. If so, you would use the following command: SQLCMD /S Server1 -U -P -i loadtestresultsrepository.sql Caution: The parameters are case sensitive.

configure Visual studio load test Database manually

  1. On the Load Test toolbar, choose Manage Test Controllers. The Manage Test Controllers dialog box is displayed.
  2. In the Load Test Results Connection String, click the browse button (…) to display the Connection Properties dialog box. Note:If you change the connection string for a controller, then you must select the controller.
  3. In Server Name, type localhost\sqlexpress or the name of the server that you used in step 2 such as Server1.
  4. Under Log on to the server, choose Use Windows Authentication.
  5. Under Connect to a database, choose Select or enter a database name. Select LoadTest from the drop-down list box.
  6. Choose OK.
  7. Choose Close in the Administer Test Controller dialog box

 

Windows 10 tweaks and tricks

Digging deep into Windows 10. Here are some of the most useful windows 10 tweaks and tricks.

  • Use the Hidden Screen Recorder App

Until now, if you wanted to record videos of the apps on your screen, you required a third-party app. However, Windows 10 changes this thanks in part to the new Xbox app. One of the new features of the Xbox app is the Game Bar, which allows not only to record footage of your gameplay but capture footage inside most of your apps as well. Naturally, this hidden functionality to record your apps is quite exciting.

To access the Game bar simply press and hold the Windows and G keys. The Game bar, which is essentially a toolbar, will then pop up on screen. If it’s your first time launching the Game bar for that app, you will get a message asking, “Do you want to open Game bar?”—simply click on “Yes, this is a game.”

windows10_recorder

  • Task view and virtual desktops

This feature was already there for MAC OS and Linux users long ago. Better late than never. Windows 10 now supports virtual desktop out off the box. To get started, click the Task View icon on the taskbar (immediately to the right of the Search box), or hold down the Windows key (abbreviated throughout as Win) and Tab. You can also drag an app to a new virtual desktop by bringing it over to the +New Desktop option at the lower right.

  •  Use Snap Assist for Split-Screen View

This feature helps to open two windows in a perfect split-screen view. To do that, start by dragging the first window to either the left or right edge of your screen. When you release your mouse button, the window will automatically be sized to fit exactly one half of your screen, then Snap Assist will populate the opposite half of your display with thumbnails of any other windows you currently have open.

  • Secret, powerful new Command Prompt tools

Windows 10 packs a new command line features, including the ability to copy and paste inside the command prompt with Crtl + C and Crtl + V.

To activate the goodies, open the command prompt. Right-click its title bar, then select Properties. You can find and enable the new features under the “Edit Options” section of the Options tab.

Note: Ctr+X will not work

  • GodMode

The legendary GodMode, a hidden staple for Windows power users, returns in windows10. As before, activating it unveils a power user menu that brings together all of your system’s far-flung settings and configuration options into a single location. Just create a new folder and rename it to following:

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Don’t forget the period after “GodMode”, and you can rename the “GodMode” portion whatever you’d like if you want another name for the folder.

GodMode

 

How to enable Dark Mode in windows 10?

Steps to Enable Dark Mode in windows 10

Microsoft has introduced a dark theme option for the new Edge browser in Windows10 is looks great.
Enable Dark mode for Edge

 

As of now it is only available for Edge browser. But there is a simple tweak to enable dark mode for Windows 10. Following are the steps to do that.

Step 1: Launch the registry editor

Run the command regedit in run window or type it in search window and select it to open.

Step2: Access the correct value as mentioned below.

HKEY_CURRENT_USER -> SOFTWARE -> Microsoft -> Windows -> CurrentVersion -> Themes -> Personalize

Step3: Add a new item of type DWORD(32) value.

Add a new value of type DWORD(32) and rename it to  “AppsUseLightTheme,”. Keep the default value set to 0.

Enable dark mode - Regedit Personalize

Step:4 Logout/restart the system.

You are now done.

Note: Updating registry is not recommended. Try at your own risk.

How To Make WiFi Tethering in Windows 8.1

Steps to Configure Wifi Tethering in Windows:

  1. Launch an elevated command prompt under Windows 8 (command prompt with administrator privileges).
    To do this Press Windows + x key in windows 8 and click Command Prompt (Admin).
  2. Execute the below command to verify that your network interface support virtualization:

netsh wlan show drivers

If the “Hosted network supported” says “Yes“, then you’re ready to share the internet via Wi-Fi. Otherwise, you need to upgrade your hardware, if the software update doesn’t fix it.

  1. Now set up the Ad-hoc wireless network (wifi tethering) using this command. Replace the parts in markup tags with your own choices

netsh wlan set hostednetwork mode=allow ssid= key=

ssid is nothing but your desired Wi-Fi name, you can give your own.

Key is nothing but your Wi-Fi password. It should be Minimum 8 characters long.

Eg : netsh wlan set hostednetwork mode=allow ssid=myhomenet key=012345678

  1. Your hosted network has been created. Now, you need to start it.
    Use the command below to start your Wi-Fi Network:

netsh wlan start hostednetwork

cmd_hosted_network1

  1. Now type exit. Command Prompt will close.
  2. Open the connected network and right click on it and select “Connection Properties“. Now open Sharing Tab (Internet Connection Sharing) and check “Allow other network option”and from the dropdown select the “Local Area Connection”and Click “OK”.

connection_properties

  1. To Check the connection, open Control Panel-> Internet and Sharing and there you will see 2 connections one is your internet connection and the other one is Local Area Connection (Which is your WiFi Created)

Selenium Ruby Binding – how ?

Good part of selenium is that the selenium tests can be written in multiple programming languages like c#, Java, Perl, PHP, Ruby etc. I normally hear saying that “This Java project, so we can write tests in Java as well”.  The only advantage I see with this is that you can get help from development team incase you are stuck somewhere. But if you are good at c# or any other language it should not be an hindrance. Test framework will be different that coding framework unless you want to integrate it.

I covered Java and C# in most of my previous posts. Here I will be using Ruby to write the Selenium tests.

 A simple Ruby Test

require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://www.google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello Selenium WebDriver!"
element.submit

require “selenium-webdriver”  – This is similar to import in Java and using in c#

The above example is without using any Test framework. In Ruby you can use Test Framework as you do with C# ( NUNIT test framework) and Java( JUNIT or TestNG framework).

In Ruby you can use minitest or BDD framework  RSpec or Cucumber

Structure of RSpec test

load File.dirname(__FILE__) + '/test_helper.rb' 
#'describe' marks the a test group
describe "Selenium Ruby Tests" do 
include TestHelper
 # 'it' marks the start of a test case, ends with the matching 'end'
it "Start Chrome" do
 browser = Selenium::WebDriver.for(:chrome) browser.navigate.to(site_url)
 sleep 1
 browser.quit
end
it "Start FireFox" do
browser = Selenium::WebDriver.for(:firefox) browser.navigate.to(site_url)
 sleep 1
 browser.quit
end
it "Start IE" do
 browser = Selenium::WebDriver.for(:ie) browser.navigate.to(site_url)
 sleep 1
 browser.quit
end 
end

For more information on RSPec click here .