SMK Binawiyata Sragen

  • This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Membuat Radio FM Arduino Uno dengan Display P10 LED Matrix

  1. Alat dan Bahan :
  • LED matrix P10 3 Block
  • Tumer FM TEA5767
  • Board Arduino Uno
  • Konverter socket DMD P10
  1. Gambar
  • LED  Matrix panel P10 


  • FM Tuner TEA5657


  • Board Arduino Uno





C. Source Kode

#include
#include
#include
#include
#include
#include
#include
#include
// Init radio object
TEA5767N radio = TEA5767N();

// Buttons codes
#define btnRIGHT    0
#define btnUP       1
#define btnDOWN     2
#define btnLEFT     3
#define btnSELECT   4
#define btnNONE     5

// Delay between clock transitions
#define DELAY_VOLUME_TRANSITION 90

// Definition of the 3-dimension array
#define MENU_DEPTH 3
#define MENU_LINES 8
#define MENU_TEXT  16

// Arduino pin for backlight intensity control
#define BACKLIGHT_PIN 3

// Arduino pins connected to digital potentiometers
// for volume control
#define UPDOWN_PIN    11
#define INC_PIN       12

// Predefined stations array
float defaultStations[16] = {88.0, 88.8,94.7,91.1,  98.4, 98.8, 101.5, 101.7,  102.2, 104.5, 106.0, 107.7,  101.4, 102.2, 103.4, 88.8};
// Initialized station arrays
float stations[16] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
byte stationIndex = 0;
byte applicationState = 0;
byte selectedMenuItem = 0;
float selectedStation;
boolean buttonWasReleased = true;
int lcd_key = 0;

// Menu labels
char menu[MENU_DEPTH][MENU_LINES][MENU_TEXT] = {
   {{" Diam"}, {" Pencarian"}, {" Cari Halus"}, {" Simpan Station"}, {" Configuration"}, {" Stand by"}, {" Load deflt stn"}, {" Exit"}},
   {{" Search level"}, {" Backlit inten."}, {" Exit"}},
   {{" Low"}, {" Medium"}, {" High"}, {"Exit"}}
  };

// Level required to search
byte searchLevel;
// Intensity of LCD backlight.
// Varies from 0 to 255
int backlightIntensity;

// Copy the predefined stations into the
// array used by the application
void loadDefaultStations() {
  for (int i=0 ; i < 16 ; i++) {
     stations[i] = defaultStations[i];
  }
}
// Convert the analog values read from Arduino pin A0
// into one of the five commands plus the NONE button 
int read_LCD_buttons() {
  int adc_key_in = analogRead(0);
  if (adc_key_in > 1000) return btnNONE; 
  if (adc_key_in < 50) return btnRIGHT; 
  if (adc_key_in < 195) return btnUP; 
  if (adc_key_in < 380) return btnDOWN; 
  if (adc_key_in < 555) return btnLEFT; 
  if (adc_key_in < 790) return btnSELECT; 
  return btnNONE;
}

byte findSelectedStationIndex(float station) {
  for (int i = 0 ; i < 16 ; i++) {
    if (stations[i] == station) {
      return i;
    }
  }
  return 0;
}

// Load the station stored in the EEPROM static memory
void loadStation() {
  byte intStation, floatStation;
  float station;
  
  intStation = EEPROM.read(0);
  floatStation = EEPROM.read(1);
  
  if (intStation != 0xFF) {
    station = (intStation * 1.0) +  (floatStation * .1);
    radio.selectFrequency(station);
    printSelectedFrequency(radio.readFrequencyInMHz());
    stationIndex = findSelectedStationIndex(station);
  } else {
    radio.selectFrequency(stations[stationIndex]);
  }
}

// Load the search level stored in the EEPROM static memory
void loadSearchLevel() {
  searchLevel = EEPROM.read(2);
  if (searchLevel == 0xFF) {
    searchLevel = MID_STOP_LEVEL;
  }
  switch(searchLevel) {
    case LOW_STOP_LEVEL: {
      radio.setSearchLowStopLevel();
      break;
    }
    case MID_STOP_LEVEL: {
      radio.setSearchMidStopLevel();
      break; 
    }
    case HIGH_STOP_LEVEL: {
      radio.setSearchHighStopLevel();
      break; 
    }
  }
}

// Load the backlight intensity stored in the EEPROM static memory
void loadBacklightIntensity() {
  backlightIntensity = EEPROM.read(3);
  analogWrite(BACKLIGHT_PIN, (byte) backlightIntensity);
}

void setupVolume() {
  // Lowest volume
  digitalWrite(UPDOWN_PIN, LOW);
  for (int i = 0 ; i < 100 ; i++) {
    digitalWrite(INC_PIN, LOW);
    delay(1);
    digitalWrite(INC_PIN, HIGH);
    delay(1);
  }
  // Pleasant level
  digitalWrite(UPDOWN_PIN, HIGH);
  for (int i = 0 ; i < 15 ; i++) {
    digitalWrite(INC_PIN, LOW);
    delay(1);
    digitalWrite(INC_PIN, HIGH);
    delay(1);
  }
}

void loadConfiguration() {
  radio.mute();
  loadDefaultStations();
  loadStation();
  loadSearchLevel();
  loadBacklightIntensity();
  setupVolume();
  radio.turnTheSoundBackOn();
}

void saveStation(float station) {
  float aux;
  byte byteValue;
  
  byteValue = (byte) floor(station);
  EEPROM.write(0, byteValue);
  aux = station - floor(station);
  aux *= 10.0;
  if (aux > 5.0) {
    byteValue = byte(aux);
    if ((((float)byteValue) - aux) > 0.1) {
      byteValue--;
    } else if ((aux - ((float)byteValue)) > 0.1) {
      byteValue++;
    }
  } else {
    byteValue = (int) ceil(aux);
  }
  EEPROM.write(1, byteValue);
}

void saveSearchLevel(byte searchLevel) {
  EEPROM.write(2, searchLevel);
}

DMD dmd(3, 1);

void ScanDMD()
{
  dmd.scanDisplayBySPI();
}
//================================================
void setup(){
  Wire.begin();
  Timer1.initialize( 500 );
  Timer1.attachInterrupt( ScanDMD );
  
  pinMode(BACKLIGHT_PIN, OUTPUT);  
  pinMode(UPDOWN_PIN, OUTPUT);
  pinMode(INC_PIN, OUTPUT);
  
  digitalWrite(UPDOWN_PIN, HIGH);
  digitalWrite(INC_PIN, HIGH);
  analogWrite(BACKLIGHT_PIN, 255);  
  
  dmd.selectFont(SystemFont5x7);
  dmd.drawString(1,0,"TEA5767 FM Radio",16,0);  
  dmd.drawString(1,9,"By Suparno, M.Pd",16,0); 
  delay(3000);
  dmd.clearScreen(true);
  dmd.drawString(36,0,"MHz",3,0);  
  // Loads configuration
  loadConfiguration();
  radio.setSoftMuteOn();  
  radio.setHighCutControlOn();
}

void printSelectedFrequency(float frequency) {
  printSelectedFrequency(frequency, 0, 0);
}

void printSelectedFrequency(float frequency, byte col, byte row) {
  char str_freq[5];
  dtostrf(frequency, 1, 1, str_freq);  
  dmd.drawString(0,0,str_freq,5,0);  
}

void printMuteStatus() {
  if (radio.isMuted()) {   
    dmd.drawString(84,9,"Mu",2,0);
  } else {
    dmd.drawString(84,9,"Re",2,0);   
  }
}

void printStereoStatus() { 
  //dmd.clearScreen(true);
  if (radio.isStereo()) {   
    dmd.drawString(60,0,"Stereo",6,0);
  } else {    
    dmd.drawString(60,0,"Mono  ",6,0);
  }
}

void markSelectedMenuItem(char *firstLine, char *secondLine) { 
  dmd.drawString(90,1,firstLine,16,0);  
  dmd.drawString(90,9,secondLine,16,0);
}

void updateLevelIndicator() {
  byte x, y, sl;
  char barGraph[17];
  
  sl = radio.getSignalLevel();
  for (x=0 ; x
    barGraph[x] = 255;
  }
  for (y=x ; y<16 div="" y="">
    barGraph[y] = 16;//32;
    barGraph[y] = '>'; 
  }
   
  dmd.drawString(0,9,barGraph,16,0);
  
}

void loop() { 
  lcd_key = read_LCD_buttons(); 
  
  if ((lcd_key != btnNONE) && radio.isStandBy() && buttonWasReleased) {
    buttonWasReleased = false;
    applicationState = 0;  
   
    radio.mute();
    radio.setStandByOff();    
    delay(150);
    radio.turnTheSoundBackOn();
    analogWrite(BACKLIGHT_PIN, (byte) backlightIntensity);  
    dmd.clearScreen(true);   
    dmd.drawString(0,0,"      MHz",16,0);   
    printSelectedFrequency(radio.readFrequencyInMHz());
  }  
  
  switch (lcd_key) {    
    case btnRIGHT: {     
      if (buttonWasReleased) {        
        buttonWasReleased = false;        
        switch (applicationState) {          
          case 0: {
            if ((stationIndex < 15) && (stations[stationIndex+1] != 0.0)) {
              stationIndex++;
            } else {
              stationIndex = 0;
            }           
            radio.mute();
            radio.selectFrequency(stations[stationIndex]);
            radio.turnTheSoundBackOn();            
            printSelectedFrequency(radio.readFrequencyInMHz());
            saveStation(stations[stationIndex]);
            break;
          }
          // Search ahead
          case 5: {
            byte isBandLimitReached = false;
            if (selectedMenuItem == 1) {
              radio.setSearchUp();
              isBandLimitReached = radio.searchNextMuting();
              if (isBandLimitReached) {
                radio.setSearchDown();
                isBandLimitReached = radio.searchNextMuting();
              }
              printSelectedFrequency(radio.readFrequencyInMHz(), 2, 0);
            }
            break; 
          }         
          case 6: {
            if (selectedStation < 108.0) {
              selectedStation += .1;
              radio.selectFrequency(selectedStation);
              printSelectedFrequency(selectedStation, 2, 0);
              saveStation(selectedStation);
            }
            break;
          }         
          case 7: {
            backlightIntensity += 10;
            if (backlightIntensity > 255) {
              backlightIntensity = 255;
            }           
            analogWrite(BACKLIGHT_PIN, (byte) backlightIntensity);
            EEPROM.write(3, (byte) backlightIntensity);
            break;
          }
        }
      }
      break;
    }    
    case btnLEFT: {
      if (buttonWasReleased) {
        buttonWasReleased = false;
        switch (applicationState) {
          // First screen, so change station
          case 0: {
            if (stationIndex > 0) {
              stationIndex--;
            } else {
              stationIndex = 15;
              while((stations[stationIndex] == 0.0) && (stationIndex > 0)) {
                stationIndex--;
              }
            }
            radio.mute();
            radio.selectFrequency(stations[stationIndex]);
            radio.turnTheSoundBackOn();
            printSelectedFrequency(radio.readFrequencyInMHz());
            saveStation(stations[stationIndex]);
            break;
          }
          // Search backwards
          case 5: {
            byte isBandLimitReached;
            if (selectedMenuItem == 1) {
              radio.setSearchDown();
              isBandLimitReached = radio.searchNextMuting();
              if (isBandLimitReached) {
                radio.setSearchUp();
                isBandLimitReached = radio.searchNextMuting();
              }
              printSelectedFrequency(radio.readFrequencyInMHz(), 2, 0);
            }
            break; 
          }
          // Decrement fine search station
          case 6: {
            if (selectedStation > 88.0) {
              selectedStation -= .1;
              radio.selectFrequency(selectedStation);
              printSelectedFrequency(selectedStation, 2, 0);
              saveStation(selectedStation);
            }
            break;
          }
          // Decrement backlight intensity
          case 7: {
            backlightIntensity -= 10;
            if (backlightIntensity < 0) {
              backlightIntensity = 0;
            }
            analogWrite(BACKLIGHT_PIN, (byte) backlightIntensity);
            EEPROM.write(3, (byte) backlightIntensity);
            break;
          }
        }
      }
      break;
    }
    case btnUP: {      
      if (buttonWasReleased || (applicationState == 0)) {
        buttonWasReleased = false;
        switch (applicationState) {
          //Volume UP
          case 0: {
            digitalWrite(UPDOWN_PIN, HIGH);
            digitalWrite(INC_PIN, LOW);
            delay(DELAY_VOLUME_TRANSITION);
            digitalWrite(INC_PIN, HIGH);
            delay(DELAY_VOLUME_TRANSITION);
            break;
          }
          // Menu navigation up
          case 1: {
            if (selectedMenuItem > 0) {
              selectedMenuItem--;
              
              if (selectedMenuItem != 3) {
               
                dmd.clearScreen(true);                
                dmd.drawString(0,0,menu[0][selectedMenuItem],16,0);               
                dmd.drawString(0,9,menu[0][selectedMenuItem+1],16,0);
              }
            }
            markSelectedMenuItem("<", " ");
            break;
          }         
          case 3: {
            if (selectedMenuItem > 0) {
              selectedMenuItem--;
              
              if (selectedMenuItem != 3) {
                dmd.clearScreen(true);                
                dmd.drawString(0,0,menu[1][selectedMenuItem],16,0);               
                dmd.drawString(0,9,menu[1][selectedMenuItem+1],16,0);
              }
            }
            markSelectedMenuItem("<", " ");
            break;
          }
          // Search level navigation up
          case 4: {
            if (selectedMenuItem > 0) {
              selectedMenuItem--;
              
              if (selectedMenuItem != 2) {
                dmd.clearScreen(true);               
                dmd.drawString(0,0,menu[2][selectedMenuItem],16,0);                
                dmd.drawString(0,9,menu[2][selectedMenuItem+1],16,0);
              }
            }
            markSelectedMenuItem("<", " ");
            break; 
          }
        }
      }
      break;
    }    
    case btnDOWN: {    
      if (buttonWasReleased || (applicationState == 0)) {
        buttonWasReleased = false;
        switch (applicationState) {
          //Volume DOWN
          case 0: {
            digitalWrite(UPDOWN_PIN, LOW);
            digitalWrite(INC_PIN, LOW);
            delay(DELAY_VOLUME_TRANSITION);
            digitalWrite(INC_PIN, HIGH);
            delay(DELAY_VOLUME_TRANSITION);
            break;
          }
          // Menu navigation down
          case 1: {
            if (selectedMenuItem < (MENU_LINES-1)) {
              selectedMenuItem++;
              
              if (selectedMenuItem != 1) {                
                dmd.clearScreen(true);                
                dmd.drawString(0,0,menu[0][selectedMenuItem-1],16,0);                
                dmd.drawString(0,9,menu[0][selectedMenuItem],16,0);
              }
            }
            markSelectedMenuItem(" ", "<");
            break;
          }         
          case 3:
            if (selectedMenuItem < 2) {
              selectedMenuItem++;
              
              if (selectedMenuItem != 1) {
                dmd.clearScreen(true);                
                dmd.drawString(0,0,menu[1][selectedMenuItem-1],16,0);               
                dmd.drawString(0,9,menu[1][selectedMenuItem],16,0);
              }
            }
            markSelectedMenuItem(" ", "<");
            break;
          // Search level navigation down
          case 4: {
            if (selectedMenuItem < 2) {
              selectedMenuItem++;
              if (selectedMenuItem != 1) {
                dmd.clearScreen(true);                
                dmd.drawString(0,0,menu[2][selectedMenuItem-1],16,0);               
                dmd.drawString(0,9,menu[2][selectedMenuItem],16,0);
              }
            }
            markSelectedMenuItem(" ", "<");
            break; 
          }
        }
      }
      break;
    }
    // Typically starts the menu or execute a command
    case btnSELECT: {
      if (buttonWasReleased) {
        buttonWasReleased = false;
        switch (applicationState) {          
          case 0: {
            applicationState = 1;
           // lcd.clear();
            dmd.clearScreen(true);
            dmd.drawString(0,0,menu[0][0],16,0);           
            dmd.drawString(0,9,menu[0][1],16,0);
            markSelectedMenuItem("<", " ");
            selectedMenuItem = 0;
            break;
          }          
          case 1: {
            switch(selectedMenuItem) {
              //Mute function
              case 0: {
                applicationState = 0;
                if (!radio.isMuted()) {
                  radio.mute();
                } else {
                  radio.turnTheSoundBackOn();
                }
                dmd.drawString(0,0, "      MHz",16,0);                
                dmd.drawString(0,9, "         ",16,0);
                printMuteStatus();
                
                // Starts station
                printSelectedFrequency(radio.readFrequencyInMHz());
                break; 
              }
              //Search
              case 1: {
                applicationState = 5;
                dmd.clearScreen(true);                
                 dmd.drawString(0,0, "<",1,0);                
                 dmd.drawString(90,0, ">",1,0);
                printSelectedFrequency(radio.readFrequencyInMHz(), 2, 0);
                break; 
              }
              //Fine search
              case 2: {
                applicationState = 6;
                 dmd.clearScreen(true);                
                dmd.drawString(0,0, "<<",2,0);               
                dmd.drawString(84,0, ">>",2,0);
                selectedStation = radio.readFrequencyInMHz();
                printSelectedFrequency(selectedStation, 2, 0);
                break; 
              }             
              case 3: {
                byte isBandLimitReached = 0;
                byte progress = 0;
                applicationState = 0;
                
                dmd.clearScreen(true);                
                dmd.drawString(0,0, "Searching ...",16,0);
                radio.mute();
                radio.selectFrequency(88.0);
                radio.setSearchUp();
                while(!isBandLimitReached && (progress < 16)) {
                  isBandLimitReached = radio.searchNext();
                  stations[progress] = radio.readFrequencyInMHz();                  
                  dmd.drawString(0,9, progress,16,0);                 
                  dmd.drawString(0,9,(char)255,16,0);
                  progress++;
                }
                radio.turnTheSoundBackOn();                
               
                dmd.drawString(0,0,"      MHz        ",16,0);              
                dmd.drawString(0,9,"                 ",16,0);
                // Starts station
                stationIndex = 0;
                saveStation(stations[stationIndex]);
                printSelectedFrequency(stations[stationIndex]);
                
                break;
              }
              //Configuration
              case 4: {
                applicationState = 3;
                dmd.clearScreen(true);               
                dmd.drawString(0,0,menu[1][0],16,0);               
                dmd.drawString(0,9,menu[1][1],16,0);
                markSelectedMenuItem("<", " ");
                selectedMenuItem = 0;
                break;
              }              
              case 5: {
                applicationState = 2;
                //lcd.clear();
                dmd.clearScreen(true);
                radio.setStandByOn();
                analogWrite(BACKLIGHT_PIN, 0);
                
                break; 
              }
              //Load default station
              case 6: {
                applicationState = 0;                
                dmd.drawString(0,0,"      MHz        ",16,0);               
                dmd.drawString(0,9,"                 ",16,0);
                // Starts station
                loadDefaultStations();
                
                radio.mute();
                radio.selectFrequency(stations[0]);
                radio.turnTheSoundBackOn();
                
                printSelectedFrequency(radio.readFrequencyInMHz());
                saveStation(stations[stationIndex]);
                break;
              }
              //Exit
              case 7: {
                applicationState = 0;               
                dmd.drawString(0,0,"      MHz        ",16,0);               
                dmd.drawString(0,9,"                 ",16,0);
                // Starts station
                printMuteStatus();
                
                // Starts station
                printSelectedFrequency(radio.readFrequencyInMHz());
                break;
              }
            }
            break;
          }
         
          case 3: {
            switch(selectedMenuItem) {              
              case 0: {
                applicationState = 4;
                //lcd.clear();
                dmd.clearScreen(true);
                if (searchLevel < 3) {                 
                  dmd.drawString(0,0,menu[2][0],16,0);                
                  dmd.drawString(0,9,menu[2][1],16,0);
                } else {                 
                  dmd.drawString(0,0,menu[2][1],16,0);                 
                  dmd.drawString(0,9,menu[2][2],16,0);
                }
                if (searchLevel == 1) {
                  markSelectedMenuItem("<", " ");
                } else {
                  markSelectedMenuItem(" ", "<");
                }
                selectedMenuItem = searchLevel - 1;
                break;
              }
              // Backlight intensity selected
              case 1: {
                applicationState = 7;
            
                
                dmd.clearScreen(true);                
                dmd.drawString(0,0,"Backlight int.",16,0);
                break;
              }
              // Exit
              case 2: {
                applicationState = 0;            
                
                dmd.drawString(0,0,"      MHz        ",16,0);               
                dmd.drawString(0,9,"                 ",16,0);
                printMuteStatus();
                
                // Starts station
                printSelectedFrequency(radio.readFrequencyInMHz());
                break; 
              }
            }
            break; 
          }
          // One of the levels selected
          case 4: {
            applicationState = 0;
            switch(selectedMenuItem+1) {
              case LOW_STOP_LEVEL: {
                radio.setSearchLowStopLevel();
                saveSearchLevel(LOW_STOP_LEVEL);
                break;
              }
              case MID_STOP_LEVEL: {
                radio.setSearchMidStopLevel();
                saveSearchLevel(MID_STOP_LEVEL);
                break; 
              }
              case HIGH_STOP_LEVEL: {
                radio.setSearchHighStopLevel();
                saveSearchLevel(HIGH_STOP_LEVEL);
                break; 
              }
            }            
                 dmd.drawString(0,0,"      MHz        ",16,0);
                 dmd.drawString(0,9,"                 ",16,0);
            printMuteStatus();
            
            // Starts station
            printSelectedFrequency(radio.readFrequencyInMHz());
            break; 
          }
          // Exit
          // Several states to exit from
          case 5: // Exit from Search
          case 6: // Exit from Fine search
          case 7: { // Exit from Backlight intensity
            applicationState = 0;
            
           
            dmd.clearScreen(true);            
            dmd.drawString(0,0,"       MHz       ",16,0);
            printMuteStatus();
            
            // Starts station
            printSelectedFrequency(radio.readFrequencyInMHz());
            break; 
          }
        }
      }
      break;
    }
    // The buttons were scanned and none were pressed
    case btnNONE: {
      if (!buttonWasReleased) {
        buttonWasReleased = true;
      }      
      switch (applicationState) {
        case 0: {         
          if (!radio.isStandBy()) {           
            printStereoStatus();
          }         
          updateLevelIndicator();
          break;
        }
        case 5: {         
          updateLevelIndicator(); 
          break;
        }
      }
      break;
    }
  } 
  delay(10);
}
Share:

Pengetahuan Dasar Pemrograman C untuk modul Arduino

Arduino adalah sebuah modul microcontroller   dgn  port input dan output   yg diprogram menggunakan bahasa  C Arduino  ( apakah dgn bahasa C yg lain juga bisa?  ya bisa tapi tdk dibahas disini).  skematiknya disini  dan rangkain schematik dgn eagle disini.
Modul arduino terdiri dari beberapa type yg membedakan hanya fitur fiturnya saja sedangkan dari segi pemrograman sama saja. beberapa type tsb antara lain : Arduino Uno, Arduino Leonardo, Arduino Due  dll.
Kelebihan Modul Arduino antara lain :
1. Mudah digunakan , cocok sekali untuk pemula.
2. Fungsi Library ( code program tinggal pakai) untuk mengakses hardware sangat banyak.  Hardware hardware tsb antara lain bluetooth,  berbagai macam sensor, GSM board, GPS , dll.
Software yg dibutuhkan 
1.  Compiler / IDE Arduino :  http://arduino.cc/en/Main/Software  (wajib)
2.  Menggambar  board Aplikasi http://fritzing.org/download/  (option)
3.  Simulasi  menggunakan proteus    (option)
Compiler / IDE arduino   digunakan untuk mengkompile bahasa C arduino dan  juga  untuk mengupload  program hasil kompile tsb  (hex file) ke  modul Arduino.
Untuk instalasi aplikasi Arduino cukup dgn  extraxt file hasil downlod tsb. Untuk membuka aplikasi klik file arduino.exe , untuk lebih praktis  buatlah  shortcut file arduino.exe di desktop PC anda.


Share:

Program Animasi LED 24x24 Dot Matrik

Kode program : dengan Bascom AVR
$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 24

'---- this section from Gif Properties
Const Total_frame = 8
Const Width = 24
Const Height = 24
'---- end of Gif Properties

Const Number_of_matrix_in_row = Width / 8
Const Byte_in_col = Height / 8
Const Frame_size = Width * Byte_in_col
Const Number_of_byte_in_8_col = Byte_in_col * 8

Declare Sub Readframe(byval Frame_number As Word)
' Port A for COL refresh
Config Porta = Output
' Port D for 74595 register
Config Portd = Output
Config Timer0 = Timer , Prescale = 64                       'Clock value: 15.625 kHz
On Ovf0 Refresh
Enable Timer0                                               ' enable the timer interrupt
Enable Interrupts
Sh_cp Alias Portd.3
Ds Alias Portd.4
St_cp Alias Portd.5
Mr Alias Portd.6
Oe Alias Portd.7
Col_port Alias Porta
Dim Col As Byte
Dim Buf(frame_size) As Byte
Dim I As Byte
Dim Matrix_counter As Word
Dim Buf_idx As Word
Dim Col_number_in_buf As Byte
Dim Frame_count As Word

Reset Mr
Set Mr
Reset Oe
Do
For Frame_count = 1 To Total_frame
 Readframe Frame_count
 Waitms 200
Next Frame_count
Loop
End                                                         'end program

Sub Readframe(byval Frame_number As Word)
 Local Idx As Word
 Local Lookup_idx As Word
 Disable Timer0
 Decr Frame_number
 'Start of Frame in lookup table
 Lookup_idx = Frame_number * Frame_size
 For Idx = 0 To Frame_size
  Buf(idx) = Lookup(lookup_idx , Ani )
  Incr Lookup_idx
 Next Idx
 Enable Timer0
End Sub

Refresh:
 Reset Mr
 Set Mr
 Col_port = &H00
 Set Oe
 Col_port = 2 ^ Col
 For Matrix_counter = 1 To Number_of_matrix_in_row
  Col_number_in_buf = Number_of_matrix_in_row - Matrix_counter
  Col_number_in_buf = Col_number_in_buf * Number_of_byte_in_8_col
  Buf_idx = Col * Byte_in_col
  Buf_idx = Buf_idx + Col_number_in_buf
  For I = 1 To Byte_in_col
   Shiftout Ds , Sh_cp , Buf(buf_idx) , 1 , 8
   Incr Buf_idx
  Next I
 Next Matrix_counter
 Reset St_cp
Set St_cp
Reset Oe
If Col < 7 Then
 Incr Col
Else
 Col = 0
End If
Return

'---- this delay table from Frame Properties
Delay:
'Frame 1
Data 200%
'Frame 2
Data 100%
'Frame 3
Data 100%
'Frame 4
Data 100%
'Frame 5
Data 100%
'Frame 6
Data 100%
'Frame 7
Data 100%
'Frame 8
Data 100%

Ani:
Data &H18, &H00, &H18 '...##..............##...
Data &H30, &H00, &H0C '..##................##..
Data &H6F, &HF7, &HE6 '.##.########.######..##.
Data &HDF, &HFC, &H23 '##.###########....#...##
Data &HBF, &HFE, &H21 '#.#############...#....#
Data &H00, &H7F, &H20 '.........#######..#.....
Data &H00, &HFF, &HA0 '........#########.#.....
Data &H3F, &HEF, &HE0 '..#########.#######.....
Data &H3F, &HDB, &HE0 '..########.##.#####.....
Data &H37, &H91, &HDE '..##.####..#...###.####.
Data &H00, &H17, &HBF '...........#.####.######
Data &H00, &H3C, &H3F '..........####....######
Data &H30, &HE0, &H3F '..##....###.......######
Data &H38, &H40, &H3F '..###....#........######
Data &H3C, &H80, &H1E '..####..#..........####.
Data &H3E, &H80, &H00 '..#####.#...............
Data &H3F, &H00, &H00 '..######................
Data &H3D, &H00, &H00 '..####.#................
Data &H3A, &H00, &H00 '..###.#.................
Data &HB6, &H00, &H01 '#.##.##................#
Data &HC6, &H00, &H03 '##...##...............##
Data &H6C, &H00, &H06 '.##.##...............##.
Data &H3C, &H00, &H0C '..####..............##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 2
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H90, &HDE '..##.####..#....##.####.
Data &H00, &H3F, &HBF '..........#######.######
Data &H00, &H10, &H3F '...........#......######
Data &H30, &H20, &H3F '..##......#.......######
Data &H38, &H20, &H3F '..###.....#.......######
Data &H3C, &H20, &H1E '..####....#........####.
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3C, &H40, &H00 '..####...#..............
Data &H38, &HC0, &H00 '..###...##..............
Data &HB1, &H80, &H01 '#.##...##..............#
Data &HC1, &H80, &H03 '##.....##.............##
Data &H61, &H80, &H06 '.##....##............##.
Data &H31, &H80, &H0C '..##...##...........##..
Data &H18, &H80, &H18 '...##...#..........##...

' Frame 3
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H18, &H00 '..#####....##...........
Data &H3C, &H18, &H00 '..####.....##...........
Data &H38, &H18, &H00 '..###......##...........
Data &HB0, &H18, &H01 '#.##.......##..........#
Data &HC0, &H18, &H03 '##.........##.........##
Data &H60, &H08, &H06 '.##.........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 4
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB0, &HDC, &H01 '#.##....##.###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H61, &HA8, &H06 '.##....##.#.#........##.
Data &H30, &H20, &H0C '..##......#.........##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 5
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB1, &H9C, &H01 '#.##...##..###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H63, &H48, &H06 '.##...##.#..#........##.
Data &H30, &H40, &H0C '..##.....#..........##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 6
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB3, &H3E, &H01 '#.##..##..#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H66, &HC8, &H06 '.##..##.##..#........##.
Data &H30, &HC0, &H0C '..##....##..........##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 7
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HBC, &H3E, &H01 '#.####....#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H7B, &H08, &H06 '.####.##....#........##.
Data &H33, &H00, &H0C '..##..##............##..
Data &H18, &H00, &H18 '...##..............##...

' Frame 8
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB0, &H3E, &H01 '#.##......#####........#
Data &HF0, &H1C, &H03 '####.......###........##
Data &H70, &H08, &H06 '.###........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...
Share:

Cara Disable IIS saat startup pada Windows 7

Terkadang kita ingin menonaktifkan IIS pada saat startup karena kita menggunakan webserver lain seperti Apache. Dengan langkah berikut, kita masih dapat menggunakan IIS tersebut, karena kita tidak mengunistallnya hanya kita cegah agar tidak langsung berjalan saat komputer kita startup. 

Masuk ke Control Panel dan pilih Administrative Tools



Dalam Administrative Tool, double klik Services

















Cari World Wide Web Publishing Service lalu klik kanan pada World Wide Web Publishing Service tersebut lalu pilih Properties











Di bawah tab General, pada Startup Type pilih Manual.


















Klik OK dan sekarang setelah restart IIS tidak akan langsung start. Jika Anda ingin menjalankan, maka jalankan secara manual.
Share:

Aplikasi Penilaian Kurikulum 2013 Kelas X SMK


Silahkan download di sini
Share:

Apa Itu WEP, WPA, WPA2, TKIP ?

WEP
WEP merupakan standart keamanan & enkripsi pertama yang digunakan pada wireless, WEP (Wired
Equivalent Privacy) adalah suatu metoda pengamanan jaringan nirkabel, disebut juga dengan Shared Key Authentication. Shared Key Authentication adalah metoda otentikasi yang membutuhkan penggunaan WEP.
Enkripsi WEP menggunakan kunci yang dimasukkan (oleh administrator) ke client maupun access point. Kunci ini harus cocok dari yang diberikan akses point ke client, dengan yang dimasukkan client untuk authentikasi menuju access point, dan WEP mempunyai standar 802.11b.
Proses Shared Key Authentication:
  1. Client meminta asosiasi ke access point, langkah ini sama seperti Open System Authentication.
  2. Access point mengirimkan text challenge ke client secara transparan.
  3. Client akan memberikan respon dengan mengenkripsi text challenge dengan menggunakan kunci WEP dan mengirimkan kembali ke access point.
  4. Access point memberi respon atas tanggapan client, akses point akan melakukan decrypt terhadap respon enkripsi dari client untuk melakukan verifikasi bahwa text challenge dienkripsi dengan menggunakan WEP key yang sesuai. Pada proses ini, access point akan menentukan apakah client sudah memberikan kunci WEP yang sesuai. Apabila kunci WEP yang diberikan oleh client sudah benar, maka access point akan merespon positif dan langsung meng-authentikasi client. Namun bila kunci WEP yang dimasukkan client adalah salah, maka access point akan merespon negatif dan client tidak akan diberi authentikasi. Dengan demikian, client tidak akan terauthentikasi dan tidak terasosiasi.
WEP memiliki berbagai kelemahan antara lain :
  1. Masalah kunci yang lemah, algoritma RC4 yang digunakan dapat dipecahkan.
  2. WEP menggunakan kunci yang bersifat statis
  3. Masalah initialization vector (IV) WEP
  4. Masalah integritas pesan Cyclic Redundancy Check (CRC-32)
WEP terdiri dari dua tingkatan, yakni kunci 64 bit, dan 128 bit. Sebenarnya kunci rahasia pada kunci WEP 64 bit hanya 40 bit, sedang 24bit merupakan Inisialisasi Vektor (IV). Demikian juga pada kunci WEP 128 bit, kunci rahasia terdiri dari 104bit.
Serangan-serangan pada kelemahan WEP antara lain :
  1. Serangan terhadap kelemahan inisialisasi vektor (IV), sering disebut FMS attack. FMS singkatan dari nama ketiga penemu kelemahan IV yakni Fluhrer, Mantin, dan Shamir. Serangan ini dilakukan dengan cara mengumpulkan IV yang lemah sebanyak-banyaknya. Semakin banyak IV lemah yang diperoleh, semakin cepat ditemukan kunci yang digunakan
  2. Mendapatkan IV yang unik melalui packet data yang diperoleh untuk diolah untuk proses cracking kunci WEP dengan lebih cepat. Cara ini disebut chopping attack, pertama kali ditemukan oleh h1kari. Teknik ini hanya membutuhkan IV yang unik sehingga mengurangi kebutuhan IV yang lemah dalam melakukan cracking WEP.
  3. Kedua serangan diatas membutuhkan waktu dan packet yang cukup, untuk mempersingkat waktu, para hacker biasanya melakukan traffic injection. Traffic Injection yang sering dilakukan adalah dengan cara mengumpulkan packet ARP kemudian mengirimkan kembali ke access point. Hal ini mengakibatkan pengumpulan initial vektor lebih mudah dan cepat. Berbeda dengan serangan pertama dan kedua, untuk serangan traffic injection,diperlukan spesifikasi alat dan aplikasi tertentu yang mulai jarang ditemui di toko-toko, mulai dari chipset, versi firmware, dan versi driver serta tidak jarang harus melakukan patching terhadap driver dan aplikasinya. sumber
WAP
Wireless Apliccation Protokol disingkat WAP adalah standar internasional terbuka untuk aplikasi yang menggunakan komunikasi nirkabel. Tujuan utamanya untuk membangun aplikasi yang dapat mengakses internet dari telepon genggam atau PDA.
Disingkat dengan WAP.
Standar protokol untuk aplikasi wireless (seperti yang digunakan pada ponsel). WAP adalah sebuah protocol atau sebuah teknik messaging service yang memungkinkan sebuah hp digital atau terminal mobile yang mempunyai fasilitas WAP, melihat/membaca isi sebuah situs di internet dalam sebuah format text khusus. Situs internet ini harus merupakan situs dengan fasilitas WAP.
Teknologi ini merupakan hasil kerjasama antar industri untuk membuat sebuah standar yang terbuka (open standard) dan berbasis pada standar Internet, serta beberapa protokol yang sudah dioptimasi untuk lingkungan wireless.
Teknologi ini bekerja dalam modus teks dengan kecepatan sekitar 9,6 kbps. Belakangan juga dikembangkan protokol GPRS yang memiliki beberapa kelebihan dibandingkan WAP.
Wireless Application Protocol merupakan sebuah protocol pengembangan dari protocol wireless data yang telah ada. Phone.com menciptakan sebuah versi standart HTML (HyperText Markup Language) Internet protocol yang didisain khusus untuk transfer informasi antar mobile network yang efisien. Terminal wireless dengan HDML (Handheld Device Markup Language) microbrowser, dan Handheld Device Transport Protocol (HDTP) dari Phone.com terhubung dengan UP.Link Server Suite yang seterusnya terhubung ke Internet atau intranet dimana informasi yang dibutuhkan berada. Teknologi inilah yang kemudian dikenal sebagai WAP. sumber
WPA2
WPA2 adalah sertifikasi produk yang tersedia melalui Wi-Fi Alliance. WPA2 Sertifikasi hanya menyatakan bahwa peralatan nirkabel yang kompatibel dengan standar IEEE 802.11i. WPA2 sertifikasi produk yang secara resmi menggantikan wired equivalent privacy (WEP) dan fitur keamanan lain yang asli standar IEEE 802.11. WPA2 tujuan dari sertifikasi adalah untuk mendukung wajib tambahan fitur keamanan standar IEEE 802.11i yang tidak sudah termasuk untuk produk-produk yang mendukung WPA. sumber
TKIP
Dalam dunia komputer, TKIP atau Temporal Key Integrity Protocol adalah sebuah protokol yang didefinisikan oleh IEEE 802.11i yang mengkhususkan untuk jaringan nirkabel untuk menggantikan WEP. TKIP didesain untuk menggantikan WEP tanpa mengubah / mengganti perangkat keras. Hal ini diperlukan karena “buruknya” jenis pengamanan WEP meninggalkan jaringan nirkabel tanpa aktif mengamankan link-layer. Solusi untuk masalah ini tidak akan menunggu untuk menggantikan manfaat dari perangkat keras. Untuk alasan tersebut, TKIP (Baca: tee-kip), seperti WEP, menggunakan skema kunci berdasarkan RC4, tetapi tidak seperti WEP, TKIP meng-enkripsi semua paket data yang dikirimkan dengan kunci enkripsi yang unik nya itu sendiri.
TKIP menghasilkan “per-packet key mixing”, sebuah pesan yang ter-integrity yang memeriksa dan sebuah mekanisme “re-keying” sehingga pengalamatan menjadi isu pengamanan dengan WEP. Hal ini menambah kerumitan dari pen-dekodean kunci dengan menurunkan ketersediaan jumlah data kepada cracker, itu telah dienkripsi menggunakan suatu kunci khusus. sumber
Share:

Simulator Arduino Gratis

Windows simulasi bebas dari Arduino Uno

Saya senang untuk mengatakan bahwa ada simulator bebas dari Arduino Uno di luar sana! Siapapun dengan komputer Windows dapat "bermain dengan" Arduino. Guru dapat menunjukkan kepada mereka untuk murid, dan membiarkan murid bermain dengan satu. Tidak ada biaya. Tidak ada "hambatan untuk masuk" dalam bentuk menguasai bit fiddly hooking up bit. Tidak ada bahaya kerusakan pada peralatan. Ini indah, besar, kontribusi kepada kita semua berasal dari Stan Simmons, sebelumnya Departemen Teknik Elektro dan Komputer di Universitas Queen di Kingston, Ontario, Kanada.



Cara mendownload :
Pergi ke http://www.sites.google.com/site/unoardusim/. Baca apa yang ada, dan menggunakan menu di sebelah kiri (ada) untuk pergi ke halaman simulator.
Sesampai di sana, tidak mengandalkan intuisi dan pengalaman untuk melakukan download. Mencatat saran sebagai berikut ...



Share:

Membuat radio FM dengan Arduino dan Nokia 5110

Membangun sebuah radio FM stereo dengan modul Arduino Uno dan TEA5767 serta dengan tampilan display diambil dari layar HP Nokia 5110 atau HP Nokia 3310. Radio FM digital sekarang banyak dijual di toko dengan sangat murah, namun yang satu ini berbeda yaitu dengan modul Mikrokontroler jenis arduino Uno dan memanfaatkan Display HP Nokia 5110. hasil dari percobaan ini cukup bagus di lokasi saya.
di bawah ini ada bebrapa komponen serta program yang disiapkan untuk pembuatan radio ini antara lain :

1. Modul Arduino UNO
2. TEA 5767





3. LCD Nokia 5110



4 Rangkaian lengkap dengan Firtsing




5


5 Sketch

// TEA5767 und Nokia 5110 LCD Display
#include
#include
#include
#include


// D3 - Serial clock out (CLK oder SCLK)
// D4 - Serial data out (DIN)
// D5 - Data/Command select (DC oder D/C)
// D6 - LCD chip select (CE oder CS)
// D7 - LCD reset (RST)
Adafruit_PCD8544 lcd = Adafruit_PCD8544(3,4,5,6,7);



#define button_frequency_up     13
#define button_frequency_down   12
#define button_mute             11

#define TEA5767_mute_left_right  0x06
#define TEA5767_MUTE_FULL        0x80
#define TEA5767_ADC_LEVEL_MASK   0xF0
#define TEA5767_STEREO_MASK      0x80


int old_frequency=-1;
int frequency=9000; //frekuensi default

byte old_stereo=0;
byte stereo=1;

byte old_mute=1;
byte mute=0;

byte old_signal_level=1;
byte signal_level=0;

unsigned long last_pressed;

void setup(void) {
 
  pinMode(button_frequency_up, INPUT);
  pinMode(button_frequency_down, INPUT);
  pinMode(button_mute, INPUT);
 
  Wire.begin();
 
  TEA5767_set_frequency();

  lcd.begin();
  lcd.setContrast(60);
  lcd.clearDisplay();
  
  set_text(1,2,"FM Radio",BLACK,1); 
  //set_text(14,147,"blog.simtronyx.de",BLACK,1);
 
}


void loop() {

    if(frequency!=old_frequency){
      set_text(old_frequency>=10000?6:14,17,value_to_string(old_frequency),WHITE,2);
      set_text(frequency>=10000?6:14,17,value_to_string(frequency),BLACK,2);
      old_frequency=frequency;
    }
   
    TEA5767_read_data();
     
    if(old_stereo!=stereo){
        set_text(old_stereo?22:28,39,old_stereo?"Stereo":"Mono",WHITE,1);
        set_text(stereo?22:28,39,stereo?"Stereo":"Mono",BLACK,1);
        old_stereo=stereo;
    }
   
    if(old_signal_level!=signal_level){
        set_text(old_signal_level<10 br="" int="" old_signal_level="" tring="">        set_text(signal_level<10 br="" int="" signal_level="" tring="">        old_signal_level=signal_level;
        show_signal_level(signal_level);
    }
   
    if(old_mute!=mute){
        set_text(1,39,old_mute?"M":"S",WHITE,1);
        set_text(1,39,mute?"M":"S",BLACK,1);
        old_mute=mute;
    }
     
    delay(50);
   
 
  if(digitalRead(button_frequency_down)==HIGH){
   
    frequency=frequency-5;
    if(frequency<8750 frequency="10800;<br">    TEA5767_set_frequency();
  }
  if(digitalRead(button_frequency_up)==HIGH){
   
    frequency=frequency+5;
    if(frequency>10800)frequency=8750;
    TEA5767_set_frequency();
  }

  if(digitalRead(button_mute)==HIGH){
   
    TEA5767_mute();
  }
 
  delay(50);
 
}

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;

unsigned int frequencyB;

unsigned char TEA5767_buffer[5]={0x00,0x00,0xB0,0x10,0x00};

void TEA5767_write_data(byte data_size){
  
  delay(50);
 
  Wire.beginTransmission(0x60);
 
  for(byte i=0;i    Wire.write(TEA5767_buffer[i]);
 
  Wire.endTransmission();
 
  delay(50);
}

void TEA5767_mute(){
 
  if(!mute){  
    mute = 1;  
    TEA5767_buffer[0] |= TEA5767_MUTE_FULL;
    TEA5767_write_data(2);
//    TEA5767_buffer[0] &= ~TEA5767_mute;
//    TEA5767_buffer[2] |= TEA5767_mute_left_right;
  }  
  else{
    mute = 0;  
    TEA5767_buffer[0] &= ~TEA5767_MUTE_FULL;
    TEA5767_write_data(2);
//    TEA5767_buffer[0] |= TEA5767_mute;
//    TEA5767_buffer[2] &= ~TEA5767_mute_left_right;
  }
   
//  TEA5767_write_data(3);
}

void TEA5767_set_frequency()
{
  frequencyB = 4 * (frequency * 10000 + 225000) / 32768;
  TEA5767_buffer[0] = frequencyB >> 8;
  if(mute)TEA5767_buffer[0] |= TEA5767_MUTE_FULL;
  TEA5767_buffer[1] = frequencyB & 0XFF;
 
  TEA5767_write_data(5);
}

int TEA5767_read_data() {
 
  unsigned char buf[5];
  memset (buf, 0, 5);
 
  Wire.requestFrom (0x60, 5);

  if (Wire.available ()) {
    for (int i = 0; i < 5; i++) {
      buf[i] = Wire.read ();
    }
       
    stereo = (buf[2] & TEA5767_STEREO_MASK)?1:0;
    signal_level = ((buf[3] & TEA5767_ADC_LEVEL_MASK) >> 4);
   
    return 1;
  }
  else return 0;
}

void show_signal_level(int level){
 
  byte xs=68;
  byte ys=8;
  for(int i=0;i<15 br="" i="">    if(i%2!=0)lcd.drawLine(xs+i,ys,xs+i,ys-i/2,level>=i?BLACK:WHITE);
  }
}

void set_text(int x,int y,String text,int color,int textsize){
 
  lcd.setTextSize(textsize);
  lcd.setTextColor(color);
  lcd.setCursor(x,y);    
  lcd.println(text);     
  lcd.display();        
}


String value_to_string(int value){
 
  String value_string = String(value / 100);
  value_string = value_string + '.' + ((value%100<10 100="" br="" value="">  return value_string;
}







Share:

Jadwal Waktu Sholat

TIME WIB

TV EDUKASI LIVE

Popular Posts

Recent Posts

Pages