Wednesday 21 October 2015

PROPELLER :: PROPELLER(ROTATING) LED DISPLAY





People often use ARDUINO platforms and other microcontrollers (pic, avr ) for making a propeller led display. If you are from a rural area like me it will be a little difficult to have such good hardware.I am trying to make one using AT89S52 microcontroller (which is very cheep).

i'm using a 11.0592MHz crystal and a 7805 for power supply leds are connected to the PORT0 of the MCU. 8 LED's are used for displaying letters. I used 7 red and 1 blue led to make it look good. you can connect LEDs to the microcontroller in two ways
  1. ACTIVE HIGH (logic '1' on MCU pin will make the LED glow)
  2. ACTIVE LOW (logic '0' on MCU pin will make the LED glow)

It is better to connect the leds in active low configuration(cathode to MCU pin and anode to Vcc through 220ohm resister for current limiting.

The whole arrangement is placed in a wheel using foam plaster so the it sticks on both sides
the wheel is attached to 6mm shaft and 1000RPM metal gare motor.




Keep the arrangement as strong as possible. So that it won't fall out of the high speed rotating platform.Try to make it stable to suppress the vibrations at high speed. I attached the 9V battery using a tape to the circuit board of MCU .It means  I am using "ON BOARD" power supply.

I arranged the LEDs on a separate PCB and connected them to the pinheads and an eight pin female connector is used to connect the 8 LEDs to connect to PORT0 of AT89S52.

I used the KIEL software to program the microcontroller. i prefer to work with C rather than assembly. I am using a USB based programmer to burn the AT89S52 MCU.

 try to make your code flexible so that you can easily modify to display any word
at first every thing was a bit messy
watch the video


   
        looks nice is isn't it.
I'm trying to make a single stand still display. calculation of proper delay is very important in making this project.because speed of  any two motors is not equal.calculate delay as per your motor.motor speed should not be less than 1000.

 for displaying each letter make a standard notation.I'm following 5*7 notation



if your motor is rotating in clock wise direction then the corresponding code will be as follows.
 leds are connected to PORT0 of AT89S52 so the logic will be
                P0=0x81; delay( );//define this function as per your motor
P0=0x6f;  delay( ); 
 P0=0x6f;  delay( );
 P0=0x6f;  delay( );
   P0=0x81;  delay( ); 
                              P0=0xff;  delay( );// to make one column gap between letters 
if it is anti clock wise then
same code in the reverse order
in this example im using the letter "A" which is symetrical
for other letters you need to follow from down to top of the code algorithm discussed above
                                                               P0=0xff;    delay( );// to make one column gap between letters
P0=0x81;  delay( ); 
P0=0x6f;  delay( );  
P0=0x6f;  delay( ); 
P0=0x6f;  delay( ); 
P0=0x81;  delay( );
similarly for active high the following notation must be followed
  so the code will be:

led=0x7e;delay();
led=0x90;delay();
led=0x90;delay();
led=0x90;delay();
led=0x7e;delay();
                                            led=0x00;delay();column gap betwwn 2 letters
so that you can display any word on your moving display

but the question is how much delay we need to use after each and every colum
follow theses calculations..
DELAY CALCULATIONS 
motor speed===1000 RPM
time for one rotation===60 milli seconds
radious =30cm
peremeter=2*3.414*30=204.84~205
width of led column=0.5cm ( this indicated the duration of led glow in terms of length of display)
total num of columns(leds)=205/0.5=410
410 leds=60 milli seconds
one led(column)time=146 micro seconds// 
columns for each letter=6
time for a letter=6*146=876 micro seconds
length for letter=6*0.5=3
total leters=205/3=68
THE CALCULATIONS VARIES ACCORDING  TO THE GLOW TIME OF LED AND RADIUS OF THE ROTATING ARM 
motor speed===1000 RPM
time for one rotation===60 milli seconds
radius =30cm
peremeter=2*3.414*30=204.84~205
width of led column=1cm( this indicated the duration of led glow in terms of length of display)
total num of columns(leds)=205
205 leds=60 milli seconds
one led(column)time=292 micro seconds
columns for each letter=6
time for a letter=6*292=1752 micro seconds
length for letter=6
total leters=205/6=34
THESE ARE ROUGH CALCULATIONS BECAUSE THE MOTOR SPEED IS NOT ALWAYS CONSTANT 
BUT THEY HELP IN APROXIMATING THE DELAY



 if you are a bit good at it
TRY WITH  "RGB" LEDS
ALL THE BEST   
EXAMPLE PROGRAM     
circuit diagram using 8051 
//THIS PROGRAM IS FOR 8051
// in this code i did not used lookup tables for reducing the complexity                                                      
// i just gave code logic for one letter'A' and space ' '                                                                               

#include<reg51.h> 

                                                                                                                            
#define led P0 //port0 will be connected to leds 
                                 
unsigned int del=50//variable to control delay
                                                                                           
void delay(void)
{
 unsigned int i,j;
for(i=0;i<del;i++)
for(j=0;j<1275;j++);

}
void display(unsigned char car); // declaration of a function 

void main()
{
 while(1)
{
  display('A'); // this displays a continious rotating"A  A  A  A"
  display(' '); 
//try to change the del value as per your motor until you get a perfect
//display once you got it then write your code for remaining letters 
//once you did this it will be very easy you can do your own fonts
//like "smily" ,"heart" etc 
//but the main logic is to achieve perfect "delay".once if you refer to the
 //delay calculations you will get it
//direction of rotation is also one important thing(clock wise or anti clock) 
// this "A" is simetrical so works on both directions.
}

}

void display(car)
{
  
  switch(car)

  case 'A' : // letter A
   
   {
    led=0x81;  delay( ); 

    led=0x6f;  delay( );  

    led=0x6f;  delay( ); 

    led=0x6f;  delay( ); 

    led=0x81;  delay( ); 

    led=0xff;  delay( );// to make one column gap between letters  
   } 
    break;
  
   case ' '  : // space
   
   {
    led=0xff;  delay( );

    led=0xff;  delay( ); 

    led=0xff;  delay( );  

    led=0xff;  delay( ); 

    led=0xff;  delay( ); 

    led=0xff;  delay( ); 
    
    led=0xff;  delay( );// to make one column gap between letters 
  
   } break;
  default:
   led=0xfe;
}
// END of program

=======================================================================================



                                             //THIS PROGRAM IS FOR AVR

// in this code i did not used lookup tables for reducing the complexity                                                      
// i just gave code logic for one letter'A' and sapace ' '                                                                              

#include<avr/io.h> 
#define F_CPU 8000000 // crystal frequency used in the circuit this helps in calibration of delay as per your frequency 
#include<util/delay.h> header file for generating delay for
                                                                                                                            
 DDRD=0xff;     //declaring portD as out put  
 #define led PORTD   // the word "led" will be replaced by PORTD at compile time                                                                       
unsigned int del=50 //variable to control delay
                                                                                          

//the delay function is ther as default in util package of winavr so use:  _delay_us( );
void delay(void)
{
 _delay_us(del);
 _delay_us(del);
 _delay_us(del);
 _delay_us(del);
}
 //remaining logic will be same for all microcontroller units

void display(unsigned char car);

void main()
{
 while(1)
{
  display('A'); // this displays a continious rotating"A  A  A  A"
  display(' ');
//try to change the del value as per your motor until you get a perfect
//display once you got it then write your code for remaining letters
//once you did this it will be very easy you can do your own fonts
//like "smily" ,"heart" etc
//but the main logic is to achieve perfect "delay".once if you refer to the
 //delay calculations you will get it
//direction of rotation is also one important thing(clock wise or anti clock)
// this "A" is simetrical so works on both directions.
}

}

void display(car)
{

  switch(car)

  case 'A' : // letter A
  
   {
    led=0x81;  delay( );

    led=0x6f;  delay( ); 

    led=0x6f;  delay( );

    led=0x6f;  delay( );

    led=0x81;  delay( );

    led=0xff;  delay( );// to make one column gap between letters 
   }
    break;

   case ' '  : // space
  
   {
    led=0xff;  delay( );

    led=0xff;  delay( );

    led=0xff;  delay( ); 

    led=0xff;  delay( );

    led=0xff;  delay( );

    led=0xff;  delay( );
   
    led=0xff;  delay( );// to make one column gap between letters

   } break;

 default:
   led=0xfe;
 // gives an underline when no letter to display blue line in the code
}
// END of program

=======================================================================================
i m giving  the example for understanding the logic of this project.you can extend the code by adding number of "switch cases" i made it for active low logic means logic zero indicates led glowing and one indicates off.
with this technique you can make your own custom designs like "heart " "smile"
by changing the "del" variable value you can change the width of a letter.because no two motors are alike.
i prefer you to go for 1000 RPMmotor from vegarobokits. Which will be around 145 Rs


This propeller LED display can be made stable using an interrupt source. An IR sensor can be used to make it stable. Better to use a IR slot sensor as shown in the picture it will be a faster compared to an LM358 based sensor. if your motor is faster than 1500 rpm then this sensor is the best.





observe this video carefully.... you will find a small yellow paper on the base ground which comes in between the slot sensor pins and triggers the display. So your display always starts from a particular point

propeller LED display on sealing fan

in the above pic the fan is shaking due to weight imbalance.

this is due to improper delay between the letters.



the video:





Bluetooth controlled rotating POV LED display 



                                  ALL THE BEST

          +++++++++++++++++++++++++++++++++++++++++++++

=============================================

NOTE: 


  DON'T JUST ASK FOR THE ENTIRE CODE.  


TRY TO


 DEVELOP IT FOR YOUR SELF 


     GO THROUGH THE ARTICLE ONCE AGAIN


 YOU 


WILL FIND EVERY THING  

+++++++++++++++++++++++++++++++++++++++++++++

=============================================

                                                                                                                                 

=========================================================================
=========================================================================  


FOR THOSE WHO WANT TO BUY THE KIT:

FREE SHIPPING ALL OVER INDIA


MAIL US AT
vaabrobotics@gmail.com


PROPELLER CLOCK :: propeller LED display

Picture of propeller LED display
DSCN4232.JPG
this is my first project about propeller LED display
it is fun working with it

if you are very much interested in this project
take a look at this

http://homemaderobo.blogspot.in/2012/03/propellerrotating-led-display.html 

Monday 19 October 2015

VB6.0 :: koneksi vb 6.0 menggunakan ADODB untuk database M.Access dan sql server



Pertama yang harus dipersiapkan yaitu:
1 database dan 1 tabel yang dibuat di M. Access
1 form (1 datagrid)
1 module

Silahkan kalian membuat databasenya dahulu dengan 1 buah tabel. Untuk tutorial ini saya mengunakan database dbbiodata dan tabel tbbiodata
Setelah database dibuat silahkan buka vbnya tambahkan 1 buah form seperti gambar dibawah ini :

 Kemudian tambahkan 1 buah module di project > Add module
 
Klik open
Lanjut … untuk koneksi menggunakan ADODB teman teman harus menambahakan microsoft activex data object
Klik menu project > references > cari microsoft activex data object 2.8 library kemudian centang dan Ok
 
Buka modul dengan mengklik 2x pada bagian sebelah kanan,kemudian tambahkan koding berikut ini


Public con As New ADODB.Connection
 
Public rst As New ADODB.Recordset
 
Public strcon As String
 
Public strsql As String
 

 
Public Sub buka()
 
On Error GoTo pesan
 
strcon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\dbbiodata.accdb;Persist Security Info=False"
If con.State = adStateOpen Then
con.Close
Set con = New ADODB.Connection
con.Open strcon
Else
con.Open strcon
End If
Exit Sub
pesan:
MsgBox "Tidak ada koneksi ke database..!", vbInformation, "Informasi"
End Sub

Public Sub tutup()
con.Close
End Sub

yang diwarna merah adalah koneksi untuk ke database acces 2007 keatas,jika anda menggunakan access  2003 atau sql server silahkan rubah dibagian itu saja.

 
Provider=Microsoft.Jet.OLEDB.4.0;Data Source==" & App.Path & "\dbbiodata.mdb;Persist Security Info=False
 

 
*database access 2003
 

 
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbbiodata
 

* database sqlsever

Kemudian kita tambahkan datagrid untuk menampilkan data biodata pada form
Caranya dengan klik menu project > component atau CTRL + T cari microsoft datagrid control 6.0 (SP6) (OLEDB) > centang lalu ok 
Buat seperti gambar dibawah ini 
 
Klik 2x pada form ketik codingnya sperti ini

Option Explicit
 

 
Private Sub Form_Load()
 
Dim lihat As New Recordset
 
Dim sql As String
 
buka
 
con.CursorLocation = adUseClient
 
Set lihat = New Recordset
sql = "Select * From tbbiodata"
lihat.Open sql, con, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = lihat.DataSource
End Sub

Simpan filenya kemudian tekan f5 untuk menjalankannya
 
Selesai
Untuk source code silahkan klik disini

VB6.0 :: TUTORIAL KONEKSI ADODC DATABASE MS ACCESS DI VB6


database acces
setelah Database mahasiswa.mdb di buat simpan dan close database tersebut..
Langkah selanjutnya Buka Editor VB kalian dan buat sebuah form dengan menambahkan 3 Label,3Textbox,4Buah CommandButton,1 Buah DataGrid Dan Tentunya 1 Buah ADODC.. Lihat Gambar Dibawah ini
Koneksi ADODC

Sebelum kita masuk Dalam coding buat dahulu suatu module yang berisi coding seperti di bawah ini:

Public Conn As New ADODB.Connection

Public Sub koneksi()
On Error GoTo konekErr

If Conn.State = 1 Then Conn.Close
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\mahasiswa.mdb;Persist Security Info=False"
Exit Sub

konekErr:
    MsgBox "Gagal menghubungkan ke Database ! Kesalahan pada : " & Err.Description, vbCritical, "Peringatan"
End Sub

Coding diatas berfungsi sebagai APP.PATH atau kalu dijabarkan adalah untuk menentukan letak database yang telah kita buat.. karena dari kebanyakan kasus dan dari pengalaman saya juga ketika kita membuat program ini di kampus maupun di komputer lain ketika kita pindahkan ke flashdisk atau dijalankan di komputer yang lain akan muncul pesan erorr mengenai Letak DataBase mahasiswa.mdb yang telah kita buat Tadi karena saat kita Memasukan Database kita secara manual lewat properti lewat ConnectionString bisa saja letak database mahasiswa.mdb yang telah kita buat berada di folder D:\mahasiswa.mdb dan ketika kita pendah ke Flashdisk dan dijalankan lewat flashdisk maka ADODC tidak menemukan leatk database.mdb tersebut Karena mungkin letaknya Berpindah Di G:\mahasiswa.mdb makanya di perlukan Coding tambahan APP.PATH tersebut sehingga ketika kita menjalankan Program tersebut di lain komputer tidak akan terjadi erorr database.. Dan Hal penting yang Harus Di ingat adalah Letakan Database Mahasiswa.mdb tersebut berada pada satu folder dengan project vb yang kita buat tadi..

Oke Selanjutnya setelah itu double click pada form1 project sehingga kita menuju pada form menu editor untuk coding..

silahkan ya langsung Copas kan saja koding dibawah ini.. tapi jika kalian ingin belajar silahkan di ketik manual.. :D

Private Sub Form_Load()
koneksi
Adodc1.ConnectionString = Conn.ConnectionString
Adodc1.RecordSource = "select * from mahasiswa"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Command1_Click()
  Adodc1.Recordset.AddNew    'Berfungsi untuk mengosongkan text dan mengisi data untuk disimpan..
  Me.Text1.Text = ""
  Me.Text2.Text = ""
  Me.Text3.Text = ""
End Sub

Private Sub Command2_Click()
'Berfungsi untuk Menghapus Data dengan konfirmasi terlebih dahulu
If MsgBox("Yakin Ingin Menghapu Data..??", vbQuestion + vbOKCancel, "konfirmasi") = vbOK Then
Adodc1.Recordset.Delete
Me.DataGrid1.Refresh
End If
End Sub

Private Sub Command3_Click()
'pencarian nama dengan inputbox
Dim sNPM As String
  sNPM = InputBox("NAMA:")
  
  Adodc1.Recordset.MoveFirst
  Adodc1.Recordset.Find "NAMA='" & sNPM & "'"
End Sub

Private Sub Command4_Click()
'berfungsi untuk menyimpan data  masukan pada textbox 
Adodc1.Recordset.Fields("NPM") = Me.Text1.Text
  Adodc1.Recordset.Fields("NAMA") = Me.Text2.Text
  Adodc1.Recordset.Fields("ALAMAT") = Me.Text3.Text
  MsgBox "Data Berhasil Disimpan..!!", vbOKOnly + vbInformation, "Konfirmasi"
  Me.DataGrid1.Refresh
End Sub

Nah Koding Diatas berfungsi Untuk MENAMPILKAN DATA ADODC PADA DATAGRID dan CodingTAMBAH,HAPUS,SIMPAN,CARI PADA ADODC..
Setelah Coding diatas sudah anda ketikan semua jalankan program anda dengan menekan F5.
Coding diatas Dibuat otomatis untuk mengkoneksikan database adodc kita ke database access secara otomatis.. jadi kita tidak perlu lagi menset ConnectionString dan memilih database pada properti vb karena semuanya sudah diset di module yang telah kita buat diatas..
Bagi yang ingin lebih lanjut silahkan Download project contoh saya di Sini DOWNLOAD