Recent Posts

Pages: [1] 2 3 ... 10
Software / Re: Duda con 3 motores 28BYJ-4...
Last post by pepepotero - Today at 07:01 pm
Lo raro es que con el programilla excitando directamente las bobinas, incluso con la alimentación del USB (que si no me equivoco son 250mA) se mueven a 15RPM los 2 a la vez. De cualquier manera, los alimento con la externa de 1A.
Según la datasheet el consumo de los 28BYJ-48 es de unos 50mA, por lo que debe ser más que suficiente con 250mA..

Con la alimentación externa de 1A debería ser más que suficiente también, pero al usar la librería se ve que el consumo aumenta bastante (no entiendo muy bien por qué). Intentaré conseguir una de 1,5 o 2A a ver que pasa.

Probando he logrado hacerlos funcionar con las 3 configuraciones básicas, sólo que tenía que variar el valor del delay del final del bucle. El programa se me puede complicar un poco, pero creo que será posible con la excitación directa.

Muchas gracias de nuevo
Project Guidance / How to add i2c lcd to project
Last post by Daniel122 - Today at 07:00 pm
Hi can anyone help please i want To add i2c lcd to project.  I am using a arduino nano.  My goal is to print whatever is printed to serial monitor to my i2c lcd.

My code is as follows:

Code: [Select]

#include <EEPROM.h>    
#include <SPI.h>        
#include <MFRC522.h>  


#define LED_ON LOW
#define LED_OFF HIGH
#define LED_ON HIGH
#define LED_OFF LOW

#define redLed 3    
#define greenLed 6
#define blueLed 9

#define relay 4    
#define wipeB A1    

boolean match = false;          
boolean programMode = false;  

int successRead;    

byte storedCard[4];  
byte readCard[4];  
byte masterCard[4];  

 /*       ////////// FOR ARDUINO NANO V3/////////
        Read pins from left to right       Read pins from bottom to top if USB is facing down
        SS     Pin 1 on MFRC522         :  D10  Pin 3 on left of usb
        SCK    Pin 2                    :  D13  Pin 1 on right of usb
        MOSI   Pin 3                    :  D11  Pin 2 on left of usb
        MISO   Pin 4                    :  D12  Pin 1 on left of usb
        RSt    Pin 7                    :  D9   Pin 4 on left of usb
        GND    Pin 6                    :  GND  Pin 14 on right of usb
        3.3V   Pin 8                    :  3.3V Pin 2 on right of usb

#define SS_PIN 10
#define RST_PIN 8
MFRC522 mfrc522(SS_PIN, RST_PIN);

///////////////////////////////////////// Setup ///////////////////////////////////
void setup() {
  //Arduino Pin Configuration
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(wipeB, INPUT_PULLUP);  
  pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);  
  digitalWrite(redLed, LED_OFF);  
  digitalWrite(greenLed, LED_OFF);  
  digitalWrite(blueLed, LED_OFF);

  //Protocol Configuration

  Serial.println(F("Access Control v3.3"));  

  //wipe code//

  if (digitalRead(wipeB) == LOW) {
    digitalWrite(redLed, LED_ON);
    Serial.println(F("Wipe Button Pressed"));
    Serial.println(F("You have 5 seconds to Cancel"));
    Serial.println(F("This will be remove all records and cannot be undone"));
    if (digitalRead(wipeB) == LOW) {    
      Serial.println(F("Starting Wiping EEPROM"));
      for (int x = 0; x < EEPROM.length(); x = x + 1) {    
        if ( == 0) {              
        else {
          EEPROM.write(x, 0);      
      Serial.println(F("EEPROM Successfully Wiped"));
      digitalWrite(redLed, LED_OFF);  
      digitalWrite(redLed, LED_ON);
      digitalWrite(redLed, LED_OFF);
      digitalWrite(redLed, LED_ON);
      digitalWrite(redLed, LED_OFF);
    else {
      Serial.println(F("Wiping Cancelled"));
      digitalWrite(redLed, LED_OFF);
  if ( != 143) {      
    Serial.println(F("No Master Card Defined"));
    Serial.println(F("Scan A PICC to Define as Master Card"));
    do {
      successRead = getID();            
      digitalWrite(blueLed, LED_ON);    
      digitalWrite(blueLed, LED_OFF);
    while (!successRead);                  
    for ( int j = 0; j < 4; j++ ) {        
      EEPROM.write( 2 + j, readCard[j] );  
    EEPROM.write(1, 143);                  
    Serial.println(F("Master Card Defined"));
  Serial.println(F("Master Card's UID"));
  for ( int i = 0; i < 4; i++ ) {          
    masterCard[i] = + i);  
    Serial.print(masterCard[i], HEX);
  Serial.println(F("Everything Ready"));
  Serial.println(F("Waiting PICCs to be scanned"));

Español / Re: Estado Pulsador
Last post by daviten - Today at 06:59 pm
Si rebote a eso me referia.
Hello guys. I will create soon a project that reads from this pyranometer sensor "". The SP Lite 2.

I'm trying to read the solar irradiance. Andy of you know how to connect the wires and make the code? PLZ help

Red +
Blue -
Black Ground
Please post links to the specifications or product pages for the encoders. I have never encountered any that have adjustable PPR.

in such a way that the unit moves more smoothly and doesn't bind as the motors are changing speed to match each other
The binding is caused by differing relative extensions of each riser of the lift. You have to match the motor speeds and the extensions.

If the two arms of the lift are correctly aligned at the home position, then one approach would be to count rotational increments of each lift axis and adjust the speed of one motor to match those.
Arduino Zero / Re: Changing Arduino Zero PWM ...
Last post by sergun2311 - Today at 06:54 pm
Hello Everyone,

I am working with SAM15x15 which uses same MCU as Zero does. I am needed to have PWM at PA23 pin. I cant understand how to change code which I found in that topic for my needs.  Can someone help me please?

Code: [Select]
// Output 250kHz PWM on timer TCC0 (6-bit resolution)
void setup()
  REG_GCLK_GENDIV = GCLK_GENDIV_DIV(1) |          // Divide the 48MHz clock source by divisor 1: 48MHz/1=48MHz
                    GCLK_GENDIV_ID(4);            // Select Generic Clock (GCLK) 4
  while (GCLK->STATUS.bit.SYNCBUSY);              // Wait for synchronization

  REG_GCLK_GENCTRL = GCLK_GENCTRL_IDC |           // Set the duty cycle to 50/50 HIGH/LOW
                     GCLK_GENCTRL_GENEN |         // Enable GCLK4
                     GCLK_GENCTRL_SRC_DFLL48M |   // Set the 48MHz clock source
                     GCLK_GENCTRL_ID(4);          // Select GCLK4
  while (GCLK->STATUS.bit.SYNCBUSY);              // Wait for synchronization

  // Enable the port multiplexer for the digital pin D7
  PORT->Group[PORTA].PINCFG[21].bit.PMUXEN = 1;
  // Connect the TCC0 timer to digital output D7 - port pins are paired odd PMUO and even PMUXE
  // F & E specify the timers: TCC0, TCC1 and TCC2
  PORT->Group[PORTA].PMUX[20 >> 1].reg = PORT_PMUX_PMUXO_F;

  // Feed GCLK4 to TCC0 and TCC1
  REG_GCLK_CLKCTRL = GCLK_CLKCTRL_CLKEN |         // Enable GCLK4 to TCC0 and TCC1
                     GCLK_CLKCTRL_GEN_GCLK4 |     // Select GCLK4
                     GCLK_CLKCTRL_ID_TCC0_TCC1;   // Feed GCLK4 to TCC0 and TCC1
  while (GCLK->STATUS.bit.SYNCBUSY);              // Wait for synchronization

  // Dual slope PWM operation: timers countinuously count up to PER register value then down 0
  REG_TCC0_WAVE |= TCC_WAVE_POL(0xF) |         // Reverse the output polarity on all TCC0 outputs
                    TCC_WAVE_WAVEGEN_DSBOTH;    // Setup dual slope PWM on TCC0
  while (TCC0->SYNCBUSY.bit.WAVE);               // Wait for synchronization

  // Each timer counts up to a maximum or TOP value set by the PER register,
  // this determines the frequency of the PWM operation:
  REG_TCC0_PER = 96;         // Set the frequency of the PWM on TCC0 to 250kHz
  while (TCC0->SYNCBUSY.bit.PER);                // Wait for synchronization
  // Set the PWM signal to output 50% duty cycle
  REG_TCC0_CC3 = 48;         // TCC0 CC3 - on D7
  while (TCC0->SYNCBUSY.bit.CC3);                // Wait for synchronization
  // Divide the 48MHz signal by 1 giving 48MHz (20.83ns) TCC0 timer tick and enable the outputs
                    TCC_CTRLA_ENABLE;             // Enable the TCC0 output
  while (TCC0->SYNCBUSY.bit.ENABLE);              // Wait for synchronization

void loop() { }
Español / Re: Problema Con Modulo Rele
Last post by daviten - Today at 06:53 pm
Vos me habias dicho que donde tengo ethernet shield no ponga nada en la salida de 5v. Por eso te preguntaba.
Code: [Select]

boolean need_beam;
int upS_perc = 60;
int sideS_perc = 40;

int dark_light = 600;
int bright_light = 700;

int readlight_maxcount = 5;
int nobeam_maxcount_delay = 10;
/////////////////END CALIBRATOR

int nobeam_count_delay;

int readlight_count;

int totalupS;
int totalsideS;

void readlightsensor() {
  int upS = analogRead(uplightSPin);                       //read the current sensor data
  int sideS =  analogRead(sidelightSPIN);                  //read the current sensor data

  totalupS = totalupS + upS;                               //SUM the readings
  totalsideS = totalsideS + sideS;                         //SUM the readings
  readlight_count++;                                       //count the readings

  if (readlight_count >= readlight_maxcount) {             //if the COUNT reading reach it's maximum

    totalupS = totalupS / readlight_maxcount;              //AVERAGE THE SUM
    totalsideS = totalsideS / readlight_maxcount;          //AVERAGE THE SUM

    //calculate the priority
    int allS = ((totalupS * upS_perc) / 100) + ((totalsideS * sideS_perc) / 100);

    totalupS = 0;                                          //RESET the SUM
    totalupS = 0;                                          //RESET the SUM
    readlight_count = 0;                                   //RESET THE COUNT

    if (allS >= bright_light) {                            //if there is already light detected
      nobeam_count_delay++;                                //make sure we really don't need light
      if (nobeam_count_delay >= nobeam_maxcount_delay) {   //count how many times you don't need light
        need_beam = false;                                 //finnaly turn the light off

    if (allS <= dark_light) {
      need_beam = true;                                    //WE NEED LOW BEAM!
      nobeam_count_delay = 0;                              //RESET the no beam needed flag so it will count again

Initial code of reading the sensor in a average way

Note that there are 2 sensors: one reading the top light and one reading the side light
Another Note: the values from the callibrate section are not calibrated in any way, just random values so far!
I guess the important information in that thread is this one:

Because the I2C chip's registers must be written all at once, these functions are needed so that the operation
of the keypad can be kept separated from the operation of the spare pin(s).
That means you must not use the Adafruit library to access the other pins but the function of the keypad library.
Displays / Re: Passive Matrix STN LCD
Last post by olikraus - Today at 06:51 pm
This is a display without timing controller and without onboard RAM. Your Arduino Pro Mini will not be able to drive this display.

Pages: [1] 2 3 ... 10