DIY Projects Internet of Things (IoT)

Interfacing a Motion Detector Sensor with a Raspberry Pi 3

In the previous posts we discussed about why Internet of Things is the buzzword of the decade and how to get started working on a Raspberry Pi to fire up an LED light. But now we’re stepping up the game from lighting up LEDs to detecting motion.

Sitting in front of the laptop staring at my pi3 and the sensors I had just bought, I was wondering what to work on. Something that is pretty cool, not mundane, something that can be used as a building block for the upcoming projects, yet not very complicated for beginners.

Some brainstorming and my natural inclination towards image processing led me to interfacing the raspberry pi with the PIR motion detector sensor. One might wonder what a motion detector sensor has to do with images. Fret not, I have a camera module that is going to come in handy for the next building block.

The bigger picture I’m looking at, is to activate the camera module and detect a face in the frame when the motion detector sensor is triggered. Watch this space for more such building blocks, like installing opencv and learning more image processing, to lead up to the bigger picture.

Introduction to the sensor:

PIR sensor is a motion detection sensor that is used to detect whether a human has moved in or out of the sensor’s range. They are inexpensive, low power, small and easy to use. PIR is made of a pyroelectric sensor, (refer image) the rectangular crystal (which detects the level of IR radiation) covered with the round can. Ideal input voltage is 5V and the output signal when motion triggers the sensor is 3V.

The IR sensor in a motion detector is split in halves, because we’re only looking to detect motion, and not the IR levels. The sensor we are using use the BISS0001 chip. This chip takes the output of the sensor and does some minor processing on it to emit a digital output pulse from the analog sensor. Remember that the sensor can also be set off by your cat, just saying!

Motion Detector Sensor Raspberry Pi 3

Moving on to the project, let’s wire up the sensor to the Raspberry pi. You could connect the sensor directly to the GPIO pins of the pi, however we’re going to be connecting via a breadboard because it is easier to expand this project in the future. Remember that the sensor would work just as good, no matter which way you pick to connect it to the pi.

  1. Plug three M to F jumpers into the three pins on the PIR sensor.
  2. Plug the input pin (PIR-VCC) into the positive row of your breadboard, ground pin (PIR-GND) into the negative row, and output pin (PIR-OUT) into the other blank row.
  3. Connect the pin 6 (GPIO-GND) on the pi, to the negative row of the breadboard and PIR-OUT into any other blank row.
  4. Use another jumper wire to connect the pin 2 (GPIO 5V) on the pi to the positive rail of your breadboard (The same rail as PIR-GND wire)
  5. Connect the pin 26 (GPIO 7) to the same rail as the PIR-OUT. This is because we will be using pin 26 as an input to sense when the PIR detects motion.

Now that the hardware setup is done, let’s push some code into the pi so that it prints out a statement when the sensor senses movement.

The PIRs have a potentiometer inbuilt, that can be tuned to adjust the sensitivity of the sensor. Clockwise tuning increases the sensitivity, so if the print statements are running on an infinite loop, then tune the potentiometer in the anticlockwise direction.

Unfortunately, this method uses up a lot of computation power and makes sure the sensor keeps sensing continuously. We definitely don’t want that when we’re working on a more “real world” application. Since this is a pet project and something that we’re going to be using as a building block to a bigger project in the future, I’m inserting time.sleep() statement to not let the sensor work continuously.

Watch this space for more posts in the coming days. We will discuss on the architecture of Raspberry Pi, why I chose the Pi3 over Pi2, and more such topics on the foundation of IoT and Raspberry Pi. Also, do let me know if you have any questions or ideas!

Internet of Things (IoT)

Why is IoT the Buzzword of the Decade?

As the car was approaching home, her GPS location was sent to the home thermostat. After a long tiring day, she entered her perfectly dim lit, warm home, to her favorite playlist playing in the background. As she sunk into the couch, over a conversation with her virtual assistant on the home speaker, she reviewed how her day went and the virtual assistant ordered pizza for dinner ..” – This isn’t an excerpt out of a movie. This is right now, we are already in the future. Well, almost. Since the term ‘Internet of Things (IoT)’ was coined first, the definition has evolved a lot. In a generic sense though, this is a highly intelligent Machine-to-Machine technology which has potential to revolutionise how we live and work.

From music speakers, to thermostats, to lights and accessories, everything has some sort of intelligence; We are living in tech heaven, to be precise. Having moved from keypads to touch interfaces, we are currently in the no interface era. All the tech giants are focussing on getting maximum done with very little interaction with the device, and that means voice-activated computing powered by artificial intelligence.

When we say IoT, they include things we use on an everyday basis, from wearables to medical parameter sensors, to geographical and environmental sensors, and sensors monitoring the working and the lifecycle of devices.

Think about it, there are so many devices we use everyday, that possibly generate so much data when connected to respective sensors. This data could lead to so many different insights on user behavior and the device lifecycle.

Sensors and Wearables:

Internet-equipped sensors on any device make it possible to tap all the unused data, and analysis of this data lead into inferences about things that are usually considered ‘offline’. This can lead to better productivity, reduce cost, and can bring about a sustainable lifestyle. The thing that makes everyone excited about the future of IoT is the versatility of solutions it provides. This makes IoT the buzzword of the decade because we can expect an explosion of IoT solutions in various sectors.

google glass wearables IoT

Wearable technology enabled clothes are connected to the phone and are recording data about everything from blood pressure to the posture. Also speaking of the Internet of Things (IoT), it is not just the companies building consumer facing products that are a big deal, there are many companies providing wireless power solutions, and cloud based solutions that are more useful to a developer.

Challenges in IoT:

One big issue in the evolution of the Internet of Things is however, the interoperability, inability to connect to all the devices using just one app. There are many companies currently aiming to solve this issue by giving cloud based solutions to connect devices among each other.

Building a successful IoT environment will require massive amounts of cooperation and coordination between firms. But now more platforms like the Google cloud platform is coming up to sync up devices on a data level, and not just with respect to connectivity alone.

Some impressive products have already been around in the market for a while now; Smart pill reminders, that provides a smart and simple solution for patients forgetting to take their daily medicine dosage, or stick to the prescribed amount of medicine. Smart door bells, that combine computer vision, facial recognition and Artificial Intelligence to bring about a revolution in door bell systems.

Just like any other field, there are many skeptics around in tech industry as well. They predict IoT as a whole as a bubble that would burst very soon. But for the rest of us, we are definitely heading towards a better, sustainable future where there’s going to be a lot more evolution happening on the IoT front.

Did you like what you read? check out this article on how to Build your first IoT Application using Raspberry Pi.

DIY Projects Internet of Things (IoT)

How to Glow an LED using Raspberry Pi and Python

Today, most of the IoT based applications and products are powered by Raspberry Pi. If you haven’t yet read the previous article, about why IoT is the buzzword of the decade, do check it out! Raspberry Pi is a pocket sized affordable computer which is both fun to play around and build projects as per your ideas. You can plug any computer monitor or TV into the Pi for the display. To get started, you can further connect a standard keyboard and mouse to use it like a mini computer. In true sense, It’s as good as a full sized desktop computer. You can browse the internet, create documents and spreadsheets, watch high definition (HD) videos and play games as well. In this article, we look at a simple DIY Project on how to build your first IoT application using Python to glow an LED.

Raspberry Pi is pretty simple to get started. It provides you a practical approach to learn programming. If you’re familiar with Python, and know how to connect LEDs and resistors to a breadboard, you are good to go! However, if you’re not familiar with Python then I recommend going through this website.

Make sure you have a Raspberry Pi with Raspbian Jessie installed. The circuit is connected as shown below.

LEDs Glow IoT Demo

Connect the LEDs and Raspberry Pi to the breadboard as shown in the diagram using Jumper Wires. Hook up the Raspberry Pi to a monitor via the HDMI port on the board.

Launch the terminal and open ‘nano’ text editor, or you could use any text editor that is already familiar to you. This demo is as simple as a Hello World program. Running the following code will make the LEDs blink.

Now that we have blinking LEDs, lets go ahead and build a silly game. Modify the current code that picks a random number from a given list, glows green LED when you guess the number correctly and glows the red LED if you’re wrong. Run the following code, happy playing!

The sheer form factor and hardware coupled with its ease of use, gives Raspberry Pi the capabilities to interact with everyday things/devices and makes it one of the favourite boards for IoT based products. People around the world are already making phenomenal tools using Raspberry Pi and also share them with the community.

I hope building your first ever IoT project was fun. Let us know what you think in the comments below. Keep checking this space for more projects in the coming days!


Cloud – fueling the “always connected” consumer trend

Its 9:06 pm on a Wednesday night. I am sitting in the Bengaluru airport by myself and eating a nasty airport Podi idli. As I wait for my flight I find myself wondering about the two things keeping me entertained at that moment – my smart phone and social media. I was compelled to think about the beautiful intersection of these two powerful trends, and how their combination has catalysed the birth of a compelling “trend” – “Always connected”

I can’t help but ponder that back at home where I am longing to get to, me and my roommate own a series of disparate devices – 2 laptops each, 1 tablet each, 1 smart phone each and a big TV; that’s a total of 9 devices! I am not trying to paint a picture of extreme addiction to digital world, but the scenario is a reality with all of us today. This goes a long way in saying that the trend in young consumers today is heading towards owning tiny, many pieces of technologies each having unique apps and services which makes them meaningful to us in a specific way. Additionally the ‘Internet of Things (IOT)’, is perceived to make debut this decade, will only make more connected devices available. An interesting phenomenon that will propel the need for IT and developers to step out of their comfort zones and embrace new ways and techniques for quickly weaving solutions that the consumers like using.

I would like to believe that consumers know what they want, they are enlightened and imaginative in how they think technology can solve their problems. In order to win today’s consumer, one has to build solutions that bring people close to each other while they are on the go, solutions that enable working people to work from anywhere, solutions that lets peoples share their thoughts, locations and reviews on just about anything from just about anywhere. Solutions that reimagine mobility for people. And most importantly solutions that can reach consumer as soon as possible!

It would make sense therefore to spend maximum time and energy into brainstorming meaningful solutions rather than provisioning infrastructure for such solutions, and given a choice – have someone else can do it for! And that’s where cloud vendors plays a very crucial role. If there is one thing that I can say with full conviction today is that, to meet the increasingly unpredictable demand of consumers who are evidently making things go viral on social media without any fair warning, the auto scaling feature of cloud computing makes the most sense.

The immense server capabilities, storage options, website hosting plans, mobile app notification, video streaming services etcetera that the cloud vendors offer out-of-the box, makes it walk-in-park easy for the solutions developer to get their ideas across to the consumers at a pace much-much faster than what they are previously used to. Whether it’s the payment model, or the services offered, the reliable cloud vendors such as Microsoft, Amazon, all in all make a compelling strategy which is ready to take on full responsibility of future.

Cloud is here to stay to fuel mobility and encourage connected-ness in consumers. Have you tried it yet?

IT News, Tech Information and Analysis

What makes a City Smart? IoT Elements and Key Interactions

Guest Author: Shakthi V

In my previous articles in the IoT series, we saw about Security & Privacy and Device Level Security needs; it is time for us to get to the final one in the series where we get to a serious possible area where we can see IoT help us. A recent study found that over the past few years, the definition of “Smart Cities” has evolved to mean many things to many people. Part of being “smart” is utilising information and communications technology and the Internet to address urban challenges. The number of urban residents is growing by nearly 60 million every year. In addition, more than 60 percent of the world’s population will be living in cities by 2050. As a result, people occupying just 2 percent of the world’s land will consume about three-quarters of its resources.

Moreover, more than 100 cities of 1 million people will be built in the next decade. This also an area where the current Indian PM is looking to move the nation into. And if implemented clearly, it will be a great thing for the economy and the quality of urban life in our country. Today, let us conclude this series about the IoT with a look at smart cities – one of the major implementations of IoT.


As the diagram above shows, there are three kinds of interactions that are important in a smart city scheme of things, People to People (P2P), People to Machine (P2M) and Machine to Machine (M2M). The processes and protocols make these interactions secure, tight and also maintain data integrity. Please note that we are talking about essential civic services also here. So security and processing overhead should not, at any cost affect the overall turn-around time of any process, the results in that case will be disastrous and counter-productive.

Now let us examine various elements in the eco-system above –

  1. People – People now have various ways of accessing the internet and methods are limited only by imagination and budget. Going forward, we are going to go beyond the humble wearable device and access the internet in very complicated ways that are just fantasy today. For example, we will be able to swallow a pill that diagnoses our entire physical health and reports it to the cloud via the internet where the medical and healthcare system will automatically respond and initiate handling and treatment based on that data. There are going to be many other ways that we are going to constantly pump data into the cloud every second. People will then become the nodes of the internet, complicated, scary but definitely on the way!
  2. Data — With IoT, devices typically gather data and send it over the Internet to a central source, where it is analyzed and processed. Rather than just reporting raw data, connected things will soon send higher-level information back to machines, computers, and people for further evaluation and decision making. This transformation from data to information in IoT is important because it will allow us to make faster, more intelligent decisions, as well as control our environment more effectively.
  3. Things – these along with people form the crux of the IoT and the smart cities. These are a heterogeneous collection of devices that collect and may/may not process data before sending it for further analysis into the cloud. Things will sense more data, become context-aware, and provide more experiential information to help people and machines make more relevant and valuable decisions. They can be permanent things built into structures like bridges for load estimation and strength evaluation or temporary things built into milk or food cartons to track movement and consumption and to update health records
  4. Process – This is a set of rules and regulations that govern the data exchange, security levels and the access grid in the IoT that runs a smart city. Relevant connections and right information coupled with right delivery help a process add value to the network and make the smart city context-aware.

And the key technical aspects that bind all these together are Big Data, Big analytics, Stable connection and clear collaboration. A well thought out infrastructure with all these driving execution is the kay foundation of a smart city.

So what are the key areas that a government can hope to implement the IoT and make a city smart? That is simple, it has to be Structure Management, Traffic Management, Water Management, Power Management, Waste Management and Policing. If we can get these functions optimized and set up with a layer of IoT whereby the sensors or devices talk to a central controller equipped with an intelligent process that makes real-time decisions based on incoming data, we have a Smart City!

Let us now try and see a few examples of how this can actually help a city and hence all of us. It is a known fact that street/road lighting consumes a major percentage of the power that is produced in the world. We also know that roughly 60% of road lighting across the world uses technology invented in the 60s. The LED lighting movement is gaining a lot of traction and the world is switching to efficient lighting solutions based on LEDs. Let us look at an IoT implementation of this.

  1. We take a survey of all the lights in the city roads, replace them with LED lights in phases
  2. Once the lights are all LED, we tie them up to a communication and control grid that has a central processing unit
  3. The Lighting CPU has a set of simple rules like
    1. Dim lights when they come on and gradually increase intensity as evening becomes night
    2. Prioritize lighting to public utility spaces where crowds gather and move around frequently
    3. As night becomes dawn and natural light takes over, dim lights first and progressively switch them off
    4. Covered structures get light till the sun is out and shining
    5. In the event of rain/storm/lightning, ensure that the lights do not short out and if that happens, switch to an available covered array that can illuminate the same area
    6. Use ground sensors to detect footfall and illuminate intensity based on density
    7. Traffic LEDS never go off/unmanned
  4. The policies above are controlled, let us say by something like an XML based protocol that enables different sensors and the lighting grid to talk the same language.
  5. At the same time, the lighting pattern. movement pattern, failure pattern and weather pattern are constantly collected on the cloud for regular analysis and lighting policy feedback
  6. Effectively, the system runs itself and optimizes itself.

The scheme above for “lighting as a service can literally save a quarter of a city’s wasted electricity in road lighting, couple that with LED light energy savings and you will have enough energy to never have a power outage in a city. And if we additionally tie a green and renewable source to power lights, the city has literally infinite lighting capability. Sounds like fantasy? It’s actually possible. Amsterdam is exploring this as we write this article.

There are many such possibilities, imagine city that calls an ambulance when it senses a citizen having a health emergency, or one that alerts the police when a known offender tried to manhandle city property or financial structures. Best is a city than can sense a potential IED, alert ER services, evacuate people and cordon off the area! Like I said, sky is the limit!

With that, I end my third article in the IoT series! Back soon with something exciting! What are your thoughts? Let us know!

IT News, Tech Information and Analysis

Device Level Security in the scheme of Internet of Things (IoT)

Guest Author: Shakthi V

Anyone who is by any stretch a stakeholder in the IoT scene will tell you that there are two major issues, one is overall security that we discussed in my previous article and then there is the device angle to security. After all, if the device isn’t ready to scale, even the most thought out security schemes will fali miserably. So it is very relevant and important that we touch upon this angle in our second discussion about the IoT that is just around the corner. Let us discuss device level issues now.

There is need for carefully thought out measures at three levels for IoT to make sense, the device, network, and system levels. Here we shall talk about the device level. There is still no broad consensus on the best implementation of security at all levels. But, how do we protect deeply embedded endpoint devices that usually have a very specific, defined mission with limited resources available to accomplish it? That is the challenge. This calls for a structured approach to induct, add and enable a device into the IoT network.

That being said, there is no “silver bullet” or magic solution to solve this. We have to fall back on to the time tested learnings of security and extrapolate, innovate and implement a solution. And this approach can be just as effective for IoT—provided we can adapt them to the unique constraints of the embedded devices that will increasingly comprise networks of the future.

So we see that there needs to be a strict process adhered to, in order to get the device level security right. The main point to note here is that security must be addressed throughout the device lifecycle, from the initial design to the operational environment. It should not be an end or compartmental part of the process. It needs to be over-arching the whole device lifecycle, from manufacture to activation to operation in the IoT scheme of things. Here are some relevant points that can make this process secure and scalable.


  1. Secure booting: When a device powers up for the first time, the authenticity and integrity of the software on the device is verified using cryptographically generated digital signatures. Similar to the way that a person signs a check or a legal document, a digital signature attached to the software image and verified by the device ensures that only the software that has been authorized to run on that device, and signed by the entity that authorized it, will be loaded. This enables initial trust for the device in the IoT. There is still possibility of malicious intent and attack.
  1. Access control: To prevent malicious attacks, different forms of resource and access control are applied. Strictly role-based access controls built into the operating system limit the privileges of device components and applications so they access only the resources they need to do their jobs. If any component is compromised, access control will cut off that component and compartmentalize the access of that component to the system so that the rest of the system is safeguarded from similar issues. This is analogous to network-based access control systems such as Microsoft® Active Directory®. Even if someone managed to steal corporate credentials to gain access to a network, compromised information would be lim­ited to only those areas of the network authorized by those particular credentials. And when a component is tagged as compromised, even that access is revoked.

  1. Device authentication: When the device is added to the network, it should authenticate itself before receiving or sending data. These devices do not have users sitting behind keyboards, waiting to input the credentials required to access the network. How can we ensure that those devices are identified correctly prior to authorization? Just like how user authentication allows a user to access a corporate network based on user name and password, machine authen­tication allows a device to access a network based on a similar set of credentials stored in a secure storage area that is enabled with communication and handshake protocols. Hence the possibility of device spoofing to attack a system is considerably nullified here. Understood assumptions here are that this level involves smart hashing and key rotation too.
  1. Firewalling and IPS: The device also needs a firewall or packet inspection capability to control traffic that is destined to terminate at the device. Embedded devices have unique protocols, distinct from enter­prise IT protocols. For example, the smart energy grid has its own set of protocols governing how devices talk to each other. That is why industry-specific protocol filtering and packet inspection capabilities are needed to identify malicious pay­loads hiding in non-compliant protocols. The device needn’t bother itself with filtering higher-level, common Internet traffic—the network appliances should take care of that—it needs to filter the specific data destined to terminate on that device, that way, the limited resources that the device has are also not overloaded.
  1. Updates and patches: Once the device is in operation, it will start receiving patches and software updates. Device or Network Operators need to roll out patches, and devices need to authenticate them, in a way that does not consume bandwidth or impair the functional safety of the device. It’s not like when Microsoft sends updates to Windows® users and ties up their laptops for 25 minutes. It’s very risky and dicey when thou­sands of devices in the field are performing critical functions or services and are dependent on security patches to protect against the inevitable vulnerability that escapes into the network. Updates and patches need to be delivered using a mechanism that does not hog the network bandwidth which is intended for critical data. They should also take into account the type of device and its capabilities when updates are delivered

So we can clearly see that, we cannot just make a device, put it on the network and enable it to serve the IoT scheme. There is a lot of thought and diligence that goes into making devices smart, and then the smart devices need to be secure and trustworthy to be added to IoT. The point above are just rough outlines that the sector is grappling with now, they will flesh out into more granular details with the passage of time. Let us know what you think!

IT News, Tech Information and Analysis

How Secure and Private is Internet of Things (IoT) ?

Guest Author: Shakthi V

Everyone is excited about the next big thing that is just around the corner! The internet of Things. The wonderful phenomenon of things talking to each other using the internet and then making our life infinitely less complicated and giving us more time to be ourselves (whatever that means), that would truly be the next stage in human evolution!

People would love their refrigerator to find out what groceries are out and message the retailer to keep them ready and while driving home from work, the car automatically stops there and the stuff is delivered. BTW, the fridge has already swiped your card to pay for it! How convenient!

But then, there is a flip side to everything! The IoT revolution. To understand that, we need to look at the underlying things that will make this scenario possible! Very broadly, there are four technologies that link Analogue and Digital realms. They are,

Picture Credits: Wikipedia -
Picture Credits: Wikipedia –
  1. Location technologies will find us anywhere – our physical location – and with ever increasing accuracy and connectivity.
  2. Cognitive technologies will enable ubiquitous verbal communication with the digital power that surrounds us.
  3. Wearable technologies are going to collect all the analogue “stuff” about what is going on inside us, and outside of us and – our personal world of Big Data – and fling this up to the Internet.
  4. Big Data or rather predictive technologies will link the Big Data of our analogue world with the digital world. Digital will make sense of it in ways meaningful to each individual and feedback to us things we need to do in the real world to have a better life. And in fact intelligent objects will do a lot of this work for us on our behalf.

The issues that are inherent to these four technologies are the challenges that will have to be tackled if the internet of things has to be a reality that makes sense and is really safe and secure too. After all, tons of personal big data is what we are talking about!

Here are my concerns about these technologies working together, the sheer scale and complexity of security required for all of them to work the way that is planned, is mind boggling. And given that complexity, are we there yet? Imagine someone hacking into this very personal fountain of private data! Just the thought is unsettling. Next is the complexity of having to manage a huge number of credentials and passwords. The third is the far-fetched possibility that a self-aware machine is on the way and this pool of data the IoT creates will enable it to just trample over our lives. I admit that the third one is far-fetched and fantastic.

Keen to buy an Android Wear, this review of Moto 360 would help you!

Think of a smartwatch. What does it know about you? Who you are? Where you are via GPS? What you’re doing via accelerometer and gyroscope? Your health? Is able to monitor your mood?

I am sure that the makers have secured these devices, but what if? And that is a big If! Think about someone hacking your car to make it think that it’s picking up grocery but actually taking you into a risky environment! Think about an unsocial element getting hold of your personal and health data. The scope of misuse is humongous here and the fact is that all these are very possible. Dismissing them as fantasy is no longer an option!

The security ramifications of the IoT are huge, we need a self-updating, threat aware, key-rotating and intelligent security framework that has AI built in to help it to learn from attempts to hack it. Then the IoT makes sense. Here are some of the areas which needs to be considered while configuring the Device Level Security on IoT.  But the definition above added with wearable tech sounds a lot like Skynet, doesn’t it? Welcome to the future! It is a bold one and we need to be careful! What do you think?