Blinking an LED on the Raspberry Pi

Introduction

The Raspberry Pi offers an array of general purpose Input-Output pins(GPIOs) which enables software running on the Linux computer to sense events in the physical world as well as effect it in very simple ways. A software program can be used to read a switch or even a sensor connected to the GPIOs in addition to the ability to send electrical signals out. For example, a user program can be used to read a simple push button which in turn can be used to trigger events in software. The user may also elect to control a single LED by switching it ON and OFF to reflect events in software.

Continue reading “Blinking an LED on the Raspberry Pi”

BBC Microbit Line Follower pt-2

Introduction

The BBC microbit is a simple development board for children to learn programming with and has been distributed to schools in the UK free of cost. You can buy the BBC micro:bit individually or in kit form with basic add ons from Kitronics in the UK here[LINK}

In the first part, we studied how to detect a simple line using the BBC microbic and a simple circuit using some jellybean parts. In this part, we go through the concept of a motor driver, the basic circuit and controlling DC motors with the BBC microbit. We then move to add the motors to a chassis and then write the basic routine to make the robot follow a simple line.

Click here for the previous post.

Here is a video tutorial and demo video for the project part 2

The Motor Driver

The L293D is a dedicated motor driving chip with 4 half H-bridges or two full H-Bridges which can be employed to control the direction two connected motors. You may choose to make an H-Bridge using transistors or even MOSFETs on a strip board etc but the single chip solution is simpler and quicker. The pin diagram and connection diagram for the L293D is shown below.

f0pzgu3hzjo67z9-large

The GPIOs in the BBC Micro:bit can be used to set the speed and direction of the motors however for this exercise, we will only be interested in modifying the direction of the motors. Since the GPIOs available on the breakout board also include the ones used for onboard peripherals such as the matrix display, we must select the ones that are unused. Take a look at the pinout diagram below. We need four IOs out of which two are used for direction and two are used for speed or turning the motors ON and OFF.

Forming a chassis

After connecting the motor driver and motors, we need to put everything together along with a chassis, wheels and our sensor board. I have made a simple chassis, but you can create something more elaborate and used different parts according to preference. The sky is the limit. Add batteries and we are good.

Write the program

We will continue using touch develop to make the program and i order to make the decision to turn right or left or move straight, we will add an IF-THEN-ELSE ladder within the loop we created the last time. The program can be downloaded as a file using the link provided at the bottom of this page. Compile the code and upload the hex file to the BBC Micro:bit.

Create a track and test

In order to follow a line, we need a line for which we use some black water colours and a white paper sheet. Draw a simple circle initially to test out the functionality. Make sure that the line is not too thick else the sensor will have problems detecting turns and will get stuck easily. We just need the line to thick enough that it is detected by each of the sensors individually.
Test her out.

Let me know what you think in the comments section and give a like and subscribe to the youtube channel for more.
Happy hacking.

Setting up a CC3200 with Energia

Introduction & Background Bits

This blog post is part of a Project titled “IoT Lamp” and also serves as a tutorial for the CC3200 and Energia beginner.

I wanted to have a wireless connection to the light so that I may be able to control the color, brightness etc like in the case of phillips hues. I however wanted something that I could modify to have four channels so that I may use my own make and color of LEDs. This ofcourse later will be used for a hydroponic garden I have already setup BUT right now the point is to have a wireless connection. I had an assortment of options from 433MHz AM modules, to a cc2500 with MSP430 or Si4455s or LPRS eRICs or even my fav CC110L. I even bought a Cypress PSoC BLE kit to experiment with because writing firmware can be a tad bit boring at time. At this point I decided to try out Energia with the CC3200 and I had tried it before but I have had… issues.

My past experiences involved messing with service packs and there were a lot of problems with the REV3.2 board and the newer service pack. Long story short- it did not work out then and now I have a new project and so Energia was given a go.

Energia?

Skip this section if you have already used energia. So what is Energia? Energia is TI’s delayed answer to Arduino- Simple! AVRs rule the DIY world because they are easy to use and that is due to the enormous community and the arduino IDE. Its based on processing IDE and is written in Java. The compiler is GCC and it can be ported to most OSs and for the most part, you don’t need to ‘install’ anything. Just copy the whole folder and bam! You are ready for the show. No messy configurations etc. You select the boards from a list and there is a library of demo code which comes with the thing, ready to go.
The downside? Its more or less based on prewritten C code like if you want to set a pin HIGH, then you call

digitalWrite(myPIN, HIGH);

which in turn passes your arguments to somewhere else and then the compiler is supposed to convert it into assembly blah blah blah. You get the point. In short, if you are an absolute control freak(like me who has memorized ASM for 8080, 8086, 8051 and AVR to the instruction cycle- I teach this stuff to undergrads!) you will never be truly happy. That is one of the reasons why I usually go Assembly or C that I know how to write and which I can predict most of the time. Energia comes in when you are either a beginner or a non-engineer or a lazy engineer 🙂 … like me in this instance. There is library for getting wifi up and running and that was my interest here. I did write a C application for a few CC3200 projects sometime back but I am not going to talk about that here. Maybe later.

Setting up the launchpad

Sounds interesting but its actually just a sequence of steps that you have to follow… EXACTLY OR YOU WILL DESTROY TIME AND SPACE!!!!

Just kidding. The CC3200 is a pretty tough cookie. Here is what you do.

If you have just taken out the LP out of the box, you should check the version of the board and the silicon. There are labels in the board that identify it like in my case REV 3.2 which tells me that its not the latest board and the latest software or firmware updates may not work for me. See the images below from http://www.ti.com/lit/ug/swru372b/swru372b.pdf

Screen Shot 2016-01-08 at 9.40.10 AM

Screen Shot 2016-01-08 at 9.38.01 AM.png

Next we need to checkout the part or silicon number. In my case it is the XCC3200HZ which is preproduction version as per

https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/399389 and there are 80Kbs used for internal purposes. The service pack release notes at http://processors.wiki.ti.com/index.php/CC32xx_Release_Notes also tell us that the device is indeed supported. Cool! Lets move on.

Screen Shot 2016-01-08 at 9.46.44 AM.png

For our exercise we want to use the Energia platform and in my case i had already use my launchpad for previous applications. Hence I downloaded and installed the standalone version of uniflash from http://www.ti.com/tool/uniflash and when your run it,

Image.png

There is an option to ‘Format’ which is what we need to do. Connect a jumper as shown in the image below and then the launchpad to the USB port. Type in the correct port number and when it asks for the size, simply enter 1MB.

Image [1].png

Image [2].png

At this point, my launchpad is pretty much good to go. Note that if you are trying to update the firmware, the instructions can be found http://energia.nu/cc3200guide/

Doing the Energia

The CC3200 is an internet on a chip device so instead of the conventional Blinking LED, I setup the MQTT Demo. Start Energia and then… Follow the screeshots…

The Hello WiFi example is pretty straightforward and all you need to do is supply the Wifi Access Point Name, password and MQTT Topic. Done. To program the board, again connect the jumper as before and then reset the launchpad. Next use the Energia’s Upload button and it should tell you that the board was successfully programmed. Take out the jumper and reset the board and when you do, it will connect to the access point and start sending messages via MQTT. Use your favorite MQTT Client to subscribe to the topic you mentioned and you should see the CC3200 talk!

Screenshot 2016-01-11 01.22.23

Screenshot 2016-01-11 01.22.55

https://vine.co/v/ibgzEB13bKp/embed/simplehttps://platform.vine.co/static/scripts/embed.js

I hope this helps you and if does add a comment and share.

Thanks again,

Cheers,

IP

A World of MQTT on ESP8266

My Tech Weblog

MQTTFrom no-where, I’ve been immersed in the world of MQTT for the past day or two. If you’ve read my previous posts you’ll know I’ve been working on home control for years, mainly as a hobby and so mainly on a budget. I’ve tried several systems out there and eventually settled on doing my own thing because many of the packages have been developed so far then stopped or they’re very complicated or expensive etc..

ESP8266My earlier posts will show you that I’m walking around with a mobile phone with fairly decent control over 3 properties right now, so it’s not that I don’t have solutions – but the controls could be more responsive, I’ve had a hell of a time with the NRF24L01 radios which I plan soon to put up against a wall and shoot and I was in the process of swapping over to some 433Mhz units…

View original post 1,256 more words

Working with Anaren AIR Booster Pack

Suraj M Shanbhag

hey guys ,

I bought the Anaren booster pack a month ago. It was my first time working with a rf module and msp.When i looked at the firmware of the booster supplied by anaren it drove me crazy. I’m sure that you might have felt the same. They  have used extensive generalization to include all possibilities and not to mention the cross referencing to be done to make it work. Me and my  friends tried to understand the code . But it was too confusing and hence we stopped. So I wrote the firmware myself. In this tutorial let us see how to do the same . In the code to follow we will use two launchpads and 2 AIR booster packs. I’ve changed the pin connections a little to communicate through UART . So basically we will be sending text from one computer to another by means of…

View original post 951 more words

Internet of Things – Unraveling technology demands & developments

Anything Connected

Every generation is said to tune into current vibration levels and raise it higher for evolution. Evolution of both technology and human life is marked by greater finesse, vividness and presence, all of it driven by evolution of thought. The concept of ‘Internet of Things’ (IoT) is an inspiring vision to bring together innumerable technology advancements in computing & communications, and further evolve those through innovation, to improve quality of human life by interconnecting physical and cyber worlds. High-profile IoT applications include Industrial Control, Home Automation, Smart Retail, Connected Health, Hi-tech Cities, Intelligent Transportation and Logistics .

iot-a

Figure – IoT Applications (Source: IoT-A)

Per Business Insider Intelligence [refer figure below], Internet of Things will connect devices in never-seen-before scale and at a faster pace than the industry has witnessed so far with PCs/smartphones/tablets, or in the future with wearables. And so the challenge in bringing alive Internet of Things…

View original post 2,034 more words