Friday, July 27, 2012

Arduino IDE not detecting serial port in ubuntu 12.04[SOLVED]

After the installation of new arduino IDE in ubuntu 12.04 , it was found that the serial port was not detected while plugging in the arduino board via usb. The problem is that the OS will not giving permission for the program to access the port.
To solve the problem simply run the IDE as super user ,so go to terminal and type ' sudo arduino'

To solve this problem permanently ,

In the terminal run ' gksudo gedit'

In gedit open /usr/share/applications/arduino.desktop file

change the line  Exec=arduino to  Exec=gksudo arduino
 save the file.

 

ARDUINO SIMULATION IN PROTEUS


Download simulation

The screenshot shows shows the simulation of an ARDUINO using AVR microcontroller in PROTEUS.
The components used are
1) AVR microcontroller - ATMEGA328P
2) 2 x capacitor- generic , 22pf
3) crystal - 16MHz

Now write a simple program in Arduino IDE , save it  and select the board type as shown in figure

Now click the upload button without connecting the arduino 
At the end of this process you will get an error message , ignore this and make sure that an 'applet' directory is created at the location where you saved the program(it may be hidden) .In the applet directory you  can see the .hex file generated.
 For Linux users  go to /tmp/ and search .hex 

Now go back to the simulation , double click on the microcontroller to get the properties window and make the following selections

 
Now run the simulation , the following pin diagram will help you to find the corresponding AVR pin of each arduino pin . 
 



EXECUTE A LINUX COMMAND IN THE STARTUP WITH ADMIN PRIVILEGE

A script that need administrative privilege can't be simply added  to the startup session . Here is a simple way to do this

step-1:In the terminal type the command ' gksudo nautilus ' , to open the file browser as super user.

step-2:Go to the location /etc/init.d/  and create a file with .sh extension,
(eg:- mount.sh)

step-3:Again go to the terminal and make the file exicutable using the following commands
cd /etc/init.d
sudo chmod +x  filename.sh (replace filename with the name of your file)

step-4:Now open the file with your favorite text editor and  at the beginning write the following script to set the path
 #!/bin/bash
then write the command that you want to execute
note:no need for writing sudo at the beginning

step-5:save the file and in the terminal run the command

sudo update-rc.dmystartup.sh defaults 99
 
The argument 'defaults' refers to the default runlevel and '100'  means the script will get executed before any script containing number 101. Just run the command ls –l /etc/rc3.d/ to see all scripts with numbers.