Google+ My Python Projects Google+

Tuesday, January 21, 2014

Make your own cheap and customizable DIY Arduino : Shrimpduino

Hi Readers,

      Welcome to the first Arduino related post in this blog. This post will discuss how one can set up a simple and low cost Arduino on a breadboard. And once again these are not my own idea but a compilation of resources that can be found in the internet scattered in different web sites/blogs. I hope this post will help those who want to have their own Arduino for having fun with electronics but cannot afford original Arduino.


Requirements:
  • Atmega 328p-PU(pico power - but costly)/Atmega 328-PU in PDIP

  • CP2102 breakout board (buy one with TX,RX,5v,3.3v,DTR pins available)
  • 16MHz Crystal
  • Breadboard
  • 0.01uf capacitors
  • 10K ohm resistor
  • Push button switch(optional)
  • Interconnecting Wires
  • An Arduino UNO/Duemilanove (which can be borrowed from a friend for a use of about 10 minutes)
  •  And a computer for programming your Arduino.

      There is not much difference exist between Atmega 328p-PU and Atmega 328-PU except their power consumption (but 328p-PU are costlier when compared to 328P).Atmega 328p-PU is the AVR microcontroller that you would find in an original Arduino UNO/Duemilanove.Apart from this  they are identical.

      The CP2102 is a low cost USB to serial converter IC , and you can buy a breakout board containing CP2102 and a USB port from ebay or any other sites.(Indian readers,I found it from Probots for about Rs.180). I will consider this piece of hardware as my best investment in hobby electronics.Along with the arduino IDE's serial port monitor it gives me miracles. Old arduino used FTDI chips which are very costly.

    16 MHz crystal,Breadboard,capacitors,resistor,wire,etc.. can be bought from any electronic component suppliers / online.

Since we are using Atmega 328 as the AVR our arduino got full compatibility of a UNO/Duemilanove.

Step 1 : Burn Arduino Opti Boot loader into Atmega 328

   The Atmega 328 you bought from the shop/online may not contain the Arduino bootloader. To test this skip to step 2.

   If the LED is not blinking follow the tutorial in 3guy1laser.com to burn the bootloader into the Atmega328.And this is where you would require an Arduino (own/borrowed).




Step 2 : Assemble your own Arduino on breadboard

Follow the stepwise and detailed tutorial on Shrimping It. Check out the blink tutorial.


Step 3 : Test other programs on your Arduino (Shrimpduino)

   The Pin mappings of Arduino and Atmega 328 are not same,but you can use the following diagram to figure it out.


     Hurray!!! you got yourself a handmade Arduino.Now have fun with it.


My Shrimpduino on Bread board



Remarks:
  • Once you have a bootloaded Atmega 328 you don't need a Arduino to bootload any other Atmega 328 for making an arduino.The Circuit setup you gotafter step 2 is a fully functional Arduino
  • The total cost of the whole setup is below 7$ (over estimated, you can have this under 5$).
  • The CP2102 you have can be used to read serial data from modules like GPS reciver,GSM module etc... when used along with Arduino IDEs inbuilt serial monitor(you will understand the effectiveness of this if you are a hobbyist with medium experience).So it's not a waste at all.
  • The Arduino once programmed is a standalone hardware,so you can make projects with the Arduino powered Atmega as its core.

That's all it folks I will come up with a cool experiment next time with the Arduino and our favourite python,till then good bye and keep playing around with the Arduino you got.  :) :) :)










Thursday, January 16, 2014

Controlling Raspberry Pi GPIO using Twitter Direct messages


Hi Readers ,

This time I am going to share you about how I did use twitter direct messages to control the raspberry GPIO (actually you can control whatever you want by modifying the script).

Here is the list of things you need:
  • Raspberry Pi with Internet connectivity
  • A twitter account for your Raspberry pi
  • Access token and secret keys of that account (will be explained later)
  • wires,LED
And of course for sending direct message you must have a twitter account and you and your Pi must follow each other.I have chosen Direct message for controlling the Pi, though you can control using tweets mentioning the Pi (but DMs avoid spamming).

Step 1 : Create Twitter account for RPi , Create an Application API from https://dev.twitter.com/ .Obtain its API access credentials (do not disclose these to others)


Step 2 : Install  tweepy (link has the installation instructions) and RPi.GPIO 
              (use sudo apt-get install RPi.GPIO from your Pi)

Step 3 : Put the API credential and Username of Pi and Account from which you wish  to DM in my python script.

download it here

Step 4 : Connect LED to GPIO4 as shown in diagram.

Step 5 : Test it with instructions send through Direct Messages sent to your Pi's account.

   This program also returns confirmation as a direct message back to you.The frequency with which the Pi checks for the new DMs are limited(here it is 4 mins.) due to regulation on API requests that can be sent to the Twitter account.So your Pi will respond to your DM command at the worst delay of 4 minutes.

     As you can see, to turn on the LED DM "ON" to your Pi's account to turn off LED DM as "OFF"(without the quotes).

    This script can be modified for projects like remote home automation, since you can access twitter anywhere in the world and the only thing you need is to your Pi be online.

So thats it, and as always feedbacks and questions are appreciated.

Before Setting Up a New Raspberry Pi

In this blog post I am going to discuss about the key points you want to consider before setting up your new Raspberry Pi for the first time use.

Targeted Audience:

             I am a newbie to the Pi. And I have just started experimenting with it. So this Post aimed at newbies like me who just have their Pi's on their hands.

Finding the things you need:

        Since Pi doesn't come with 'all batteries included'. I had to think and search a lot on the Internet before purchasing gadgets that make the Pi work. This blog is for easing off the head ache of other beginners of Pi like myself. Although you would find the official documentation for setting up a Pi,there are some other facts you have to care.

  1. Power Supply 5V,micro USB  port
  2. SD Card above Class 4,capacity >=4Gb
  3. Monitor with HDMI connectivity,or old TV monitor with RCA,USB keyboard,mouse(optional for headless setup


1.Power Supply for the Raspberry Pi
          Before choosing a Power supply for your Pi, look for the specifications for it. Any high end mobile phone charger with micro usb port might well be serve as a power supply for your Pi,provided it can provide sufficient current.

For a Model A Raspberry : choose a charger with current rating >= 800mA.Although the official documentation says,only 500mA is required :- it is for running the Pi alone.In the near future you will have to connect peripherals like keyboard,mouse,camera,USB flash drives etc... which also draws current from the power supply. So some extra current rating won't harm your Pi(But extra Voltage will!). And check the Volage provided by the charger before you connect it to Pi, it should be less than 5.25V(above may result in overcooked Pi) and greater than 4.75V(lesser will result in corruption in the SD card).

For Model B Raspberry the current rating should be >= 1000mA.

2.SD Card 

        Before buying a SD Card for your Raspberry Pi. Look not only at the specification but also look whether it is supported by your RPi. For that visit the following link whose data base is updated with the RPi users around the world,which list the working and non-working SD cards. I would recommend you to choose a SD card of class 6 or greater for good performance of the Pi. 

3.Monitor for the Pi

       Actually I don't have a monitor for the Pi. But I found a solution for that : You can run your Pi headless(without its own monitor). You can your computer monitor,keyboard and mouse for accessing your Pi.This will be discussed in my upcoming blog posts.

Doubts, feed backs if any are always welcomed. Thank you.:)



New Changes to the blog contents.....

Hi everyone,
    I have decided to include all of my hobby projects in this blog from now on. I have decided to cover Raspberry Pi as well as Arduino and other Open Hardware and software platforms also.