Light Sensor using Arduino

Introduction

In this project, a simple light sensor is designed using LDR. The project is built around Arduino.

Components required

  • Arduino UNO
  • Light Dependent Resistor (LDR)
  • 100 KΩ POT
  • Buzzer

Circuit Diagram

Working

A 100 KΩ POT and the LDR form a voltage divider and the output of the voltage divider is given to the analog input A0 of Arduino. A buzzer is connected to pin 11 of Arduino.

When the LDR detects a light over certain intensity, the Arduino will trigger the buzzer. When the intensity of light decreases, the buzzer is turned off.

The 100 KΩ POT used in the voltage divider network can be used to adjust the intensity levels at which the buzzer is triggered.

Code

int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
pinMode(11,OUTPUT);
}
void loop()
{
sensorValue=analogRead(sensorPin);
if(sensorValue <= 14)
digitalWrite(11,HIGH);
else
digitalWrite(11,LOW);
Serial.println(sensorValue);
delay(2);
}

This circuit is similar to dark sensor circuit using BC547 transistor.

What is Omega 2 Board?

Omega 2 board is the development boards from Onion. It comes packed with built-in Wi-Fi and on-board flash storage. You do not have to worry about buying Wi-Fi dongles or installing operating system images onto external SD cards.

Using the Omega2 is just like using a desktop computer. It has built simple and intuitive apps  to interact with the Omega2. It also have an App Store where you can discover even more apps. The Omega2 runs the Linux Embedded Development Environment (LEDE) operating system, a distribution based on OpenWRT.  You can think of the Omega2 as a tiny Linux server with Wi-Fi.

The Omega2 can be easily added to your existing Arduino projects. Another important benefit of running Linux is that the Omega2 can be programmed with whatever language you want.

Omega 2 Specs

Memory64MB Memory
Storage16MB Storage
USBUSB 2.0
MicroSD Slot
No
WiFi adapterb/g/n Wi-Fi
GPIOs15
PWM2
UART2
I2C1
SPI1
I2S1

Pin out

Omega2 Accessories

 

Expansion Docs

The Expansion Dock powers the Omega2, it breaks out all of the GPIOs, and allows you to expand your Omega2 with expansion modules. It has a USB-to-serial chip on-board, allowing you to access the Omega2 easily through the serial terminal.

Mini Dock

The Mini Dock provides power to the Omega2, and it allows you to plug in USB devices

 Power Dock

Arduino Dock

 

 

UI Automation using Appium and WinAppDriver

Introduction to Appium

Appium is an open source cross platform test automation framework for use with native, hybrid and mobile web apps. It drives iOS, Android, and Windows apps using the WebDriver protocol. Platforms supported are:

  •  iOS
  • Android
  • Windows
  • FirefoxOS

Step 1: Installing Appium in Windows machine

npm install -g appium  // get appium
npm install wd   // get appium client
appium &         //Start appium

Appium install

Note: Appium will install WindowsAppDriver automatically.

You can explicitly install WindowsAppDriver.exe from 

https://github.com/Microsoft/WinAppDriver/releases

Step 2: Writing your Test code( classic Windows app)

You can use any Selenium supported language and specify the full executable path for the app under test in the app capabilities entry. In my example I will be using C#.

Following is a sample code to create test session for Windows Notepad.

 If you are using Appium as mentioned in Step 1, do not forget to add /wd/hub in ur URL.

You can get the complete sample project at my Github site.

namespace NotepadExample
{
    [TestClass]
    public class NotepadBase
    {
        // Note: append /wd/hub to the URL if you're directing the test at Appium
        protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723/wd/hub";
        protected static WindowsDriver<WindowsElement> NotepadSession;

        [ClassInitialize]
        public static void NotepadBaseSetup(TestContext testcontext)
        {
            if (NotepadSession == null)
            {
               //launch the Notepad app
               DesiredCapabilities appCapabilities = new DesiredCapabilities();
               appCapabilities.SetCapability("deviceName", "WindowsPC");
               appCapabilities.SetCapability("app", @"C:\Windows\System32\notepad.exe");
               NotepadSession = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
            }
        }
        [TestMethod]
        public void TestMethod1()
        {
          NotepadSession.FindElementByClassName("Edit").SendKeys("This is an automated text......");
          Assert.IsNotNull(NotepadSession);
        }
        [ClassCleanup]
        public static void NotepadBaseTearDown()
        {
            if (NotepadSession != null)
            {
                NotepadSession.Dispose();
                NotepadSession = null;
            }
        }
    }
}

Using Appium you can write tests with any WebDriver compatible language such as Java, C#, Nodejs, PHP, Phython, Ruby or Perl With the Selenium WebDriver API. It removes limitation of Selenium by providing support to Windows based desktop applications.

Watch the video for easy reference.

 

How to install Linux on Windows 10 machine?

Introduction

This blog will show you how to install Linux on Windows 10 machine without dual boot option and partitioning your hard drive. In this method we will be using a software called Virtualbox from Oracle. It will allow you to run other operating systems on top of your current OS.  You can use any version of Linux. I will be using Ubuntu 16.04.2.

Following are the high level steps required to install Linux on Windows 10.

Steps Required To Install Linux On Windows 10

Step 1 - Downloads

  • Download Oracle Virtualbox and virtual box extension pack and install from here.
  • Download Linux from here

Step 2 - Creating Ubuntu virtual machine within Oracle Virtual box. 

Install Virtualbox and create a Ubuntu virtual machine

  • Click on the "New" option on the toolbar
  • Enter a descriptive name into the "Name" box
    • Select Linux as the "Type"
    • Choose Ubuntu as the "Version".
    • Click "Next" to continue.

Note:
Choose a correct version of UBUNTU i.e 32 or 64 bit.
If VirtualBox is only showing 32 bit versions in the Version list make sure:
▪ Your Host OS is 64-bits
▪ Intel Virtualization Technology and VT-d are both enabled in the BIOS
▪ The Hyper-V platform is disabled in your Windows Feature list.

  • Allocate Memory to the virtual machine. For Ubuntu16.04.2 2 GB is sufficient but you can allocate more if you have sufficient memory.
  • Create a virtual hard drive. Select default VDI as the hard drive type. Also while selecting physical disk, you can select fixed size or dynamically allocated size. Note that there is no partitioning on your actual hard disk. All that happens is that a file is created on your computer which acts as the hard drive.

Step 3 - Install Ubuntu within Virtual box

Start the Virtual Machine. The first boot requires you to select a start-up disk. You can mount the iso file downloaded earlier. Follow step by step process of installing. I will not cover the details of installing here.

Step 4 - Install Vbox Guest edition(optional)
Download and install Virtualbox Guest Additions
Installing guest editions will help you scale Ubuntu properly in full screen mode.

How to Measure DevOps Success?

How do you measure DevOps success ?

You may not know if you are achieving success with your DevOps implementation unless you measure it and also manage it continuously to keep the key performance indicators (KPI) in right balance.

Following are the few KPIs that help in measure DevOps success.

  • KPI 1 Quality
  • KPI 2 Speed
  • KPI 3  Application Performance
  • KPI 4 Customer experience
  • KPI 5 Business Success

Quality

Underline principle of DevOps is faster and better software delivery.

Shorter development cycles and close collaboration under a DevOps approach mean you catch problems before they go to production, and so spend less time fixing them.

Software quality is directly correlated to customer- impacting issues, so it pays to invest time and energy into addressing quality issues earlier in the cycles. Anyways you do not want customers to be the ones discovering your issues.

Following metrics  can help track and quantify the quality of  your software’s overall continuous improvement efforts:

  • Deployment success/failure  rate
  • Application error rates
  • Issue severity
  • Outstanding bugs

Since many quality issues do not appear until the software hits production, the ability to compare all metrics pre/post deploy is extremely helpful in understanding the impact of a specific release. This approach also allows teams to respond quickly and rollback a release or provide a quick resolution to any incidents that have occurred.

Speed

DevOps teams need to focus on the speed of development, delivery, and response to issues that occur in production. Metrics to consider for helping to track progress and success in this area include:

  • Lead time for changes
  • Frequency of code releases
  • Mean time to resolution

Application Performance

Catching performance problems before they manifest requires tracking number of performance metrics like

  • Up-time (availability)
  • App response time
  • Database response time
  • % of transaction time spent in database
  • Slow SQL queries
  • Resource usage

Customer experience

A poor application performance will result in bad customer experience. Customer experience KPI is directly related to Application performance.  Following are the few metrics that can help measure customer experience.

  • Response time of key transactions
  • Frequency of key transactions
  • Number of visits per user/per week
  • User growth rates
  • Amount of time spent in app

Business Success

Business success can be measured by measuring goals that are important for the company. For example a software can be valuable to the company when it helps grow the customer base, increase revenue, reduce customer service costs,  or some other objectives.

These objectives can be identified by talking to the business stakeholders and understand their business goals and how they will be impacted by delivering the software quickly.

Measure DevOps Success Picture

In a nutshell, all the KPIs are interrelated to each other and impact each other. If we have quality  and or Speed issues on production it will result in bad customer experience which in turn will lead to reduced business success. So, if we measure the 5 KPIs we can find out if our DevOps implementation is resulting in Business success.

KPIMetrics
Quality1. Deployment success/failure rate
2. Application error rates
3. Issue severity
Outstanding bugs
Speed1. Lead time for changes
2. Frequency of code releases
3. Mean time to resolution
Application Performance1. Uptime (availability)
2. App response time
3. Database response time
4. % of transaction time spent in database
5. Slow SQL queries
6. Resource usage
Customer Experience1. Response time of key transactions
2. Frequency of key transactions
3. Number of visits per user/per week
4. User growth rates
Amount of time spent in app
Business SuccessDepending on Business Goals.

What is DevOps

What is DevOps?

DevOps is a term used to refer a set of practices that emphasize the collaboration and communication of software developers and Information technology(IT) professional while automating the process of software delivery and infrastructure changes. It aims at establishing a culture and environment where building. Testing and releasing software  can happen at a high velocity and more reliably.

Note that it does not comprises of any one tool neither it excludes any one activities that we do in traditional delivery model.

One of the goal of DevOps is to having an environment where releasing more reliable application can happen more frequently.

To implement DevOps we may need many tools. Many of the tools we already used in one or the other activities.

Under a DevOps model, development and operations teams are no longer “siloed.” Sometimes, these two teams are merged into a single team where the engineers work across the entire application lifecycle, from development and test to deployment to operation. Testing/QA  and security teams also become more tightly integrated with development and operations. They use different set of tool which help them operate and evolve applications quickly and reliably. These tools also help engineers independently accomplish tasks (for example, deploying code or provisioning infrastructure)

Benefits of DevOps

  • Shorter time to Market
  • Speed
  • Rapid Delivery
  • Reliability
  • Scale
  • Improved collaborations
  • Security

Transitioning to DevOps requires a change in culture and mindset. At its simplest, DevOps is about removing the barriers between two traditionally siloed teams, development and operations. In some organizations, there may not even be separate development and operations teams; engineers may do both. With DevOps, the two teams work together to optimize both the productivity of developers and the reliability of operations. They strive to communicate frequently, increase efficiency, and improve the quality of services they provide to customers.

 

What are DevOps essential practices?

  1. Frequent but small updates
  2. Continuous integration
  3. Continuous Deployment/Delivery
  4. Microservices
  5. Infrastructure as a Code
  6. Configuration management
  7. Policy as a code
  8. Monitoring and Logging
  9. Communication and collaboration

 

DevOps tool set

There are no single tools that can achieve all practices. We need different set of tools. Some of the tool categories are listed below.

  1. Code — Code development and review, version control tools, code merging [ eg: GitHub, TFS ]
  2. Build — Continuous integration tools, build status [ eg: TFS, Jenkins]
  3. Test — Test and results determine performance [ eg: TFS test tools, Selenium etc]
  4. Package — Artifact repository, application pre-deployment staging
  5. Release — Change management, release approvals, release automation
  6. Configure — Infrastructure configuration and management, Infrastructure–as–Code tools [Eg: Docker, Puppet, Vagrant ]
  7. Monitor — Applications performance monitoring, end–user experience [ eg: NewRelic, Azure Application Insights]

For more details on DevOps refer the following sites.

Make your own Li-ion power bank

Introduction

There are many ways to make a Li-ion power bank. We will here use 3.7v Li-ion rechargeable battery and few other modules. You can purchase the battery from ebay or Aliexpress or extract from your old laptop battery. This power bank can be used for charging smartphones.

What all you need ?

Following are the components/module required to make your own Li-ion power bank. In the below project I have used only one battery of capacity 2600 mAH. You can add more battery in parallel to increase the capacity of your Li-ion power bank.

  1. Li-ion 3.7 volt battery of type 18650 and 2600mAh
  2. 5V Mini MICRO USB 1A TP4056 Lithium Battery Charging Charger ModuleCharger_module
  3. DC-DC Boost Converter Step Up Module 1-5V to 5V Booster_module
  4. A case of your choice
  5. USB connectors

Assembly

  • Connect Li-ion battery positive and negative to charger module B+ and B- respectively. The charging module has mini usb connector which can be used as input 5 v charging voltage. You can also connect In+ and In- to Solar panel (optional)
  • Connect DC-DC boost converter to Battery via a switch. IN+ and IN- of boost converter should be connected to battery.
  • Connect Ground and 5v to USB connector as output.

The battery charger module, is designed around a dedicated lithium-ion battery charger TP4056 chip. The onboard charge controller chip handles BATT.1 charging operation by processing the 5V DC input supply received through the USB socket (or through IN+ and IN- terminals). Output terminals (BAT+ and BAT-) can be directly connected to BATT.1. Two onboard SMD LEDs located on top of the circuit board provide charging-status indications.

BATT is used as the power reservoir. Since only 3.7V DC supply is available from BATT, DC-DC boost converter is used to cater to the stable 5V DC supply at output. If input voltage of 0.9V to 5V DC is available, this converter gives stable 5V DC output through its USB socket. When the battery is fully charged, a blue-coloured LED will turn on. You may remove the charger connected at USB-IN.

Li-ion power bank