Archive for the ‘Uncategorized’ Category

ATtiny104 Xplained NANO Pinout Reference

April 7, 2016 Leave a comment

My Quick Pinout Reference of the ATtiny104 Xplained NANO Development Kit:


Arduino For Free, Almost.

September 9, 2015 Leave a comment


It is amazing how the movement initiated by the Arduino Team has led to a widespread growth of both hardware and software to develop applications using microcontrolers.

This growth has allowed to offer an Arduino UNO Compatible for only $2.84 (Including shipping to many countries).

One of Massimo Banzi’s aspirations was to have an inexpensive and easy way to create devices that interact with their environment using sensors and actuators. Mission accomplished !.



I got this Arduino UNO compatible from China (Delivered in 10 days). After installing te CH340G driver, I was able to download sketches without problems.



While taking some pictures with the Magnifier Plus-HD of my Galaxy NOTE, started to realize how well designed and assembled is this development board.



Upon inspection of this Arduino compatible we can observe :

-AMS 1117-3.3, 3.3 Volts regulator, capable of providing 1 Ampere. The regulator is capable of feeding radios and telephone modems directly, specially the ESP8266 for Internet connections.

– 25V capacitors, instead of the usual 16V used in some clones.

-16Mhz Crystal, instead of a Ceramic Resonator, which allows us to measure time more precisely.

-MICRO-USB connector. Much more common and easy to find.

-Additional holes to solder headers for:

*Double connector for the whole Arduino I/O.

* Analog pins A6 and A7.

*Serial connection (GND 5V TX RX)

*I2C onnection (GND 3.3V SCL SDA)

Originally was considered the use of the DIP-28 package rather than the SMD counterpart of the ATMEGA328 in the Arduinos, now it turns out that is less expensive to replace the whole product instead of substitute the ATMEGA328. You can buy from MOUSER or DIGIKEY the microcontroller in 10 counts for a price bigger than the complete board! . This without taking into consideration that one still has to burn the bootloader in the new device.


We are very fortunate to live in this age with plenty of sensors and controllers to experiment with.

All of this is empowering people to create new solutions to old problems, many of them will become products and prosperous business.

In honor of the enormous contribution the Arduino Team has made and continue making, I absolutely support the purchase of their products to give continuity to the great project of democratizing knowledge.

The open hardware and open software movements has allowed everyone to have access to these advances without regards of their socio-economic status.

You did it Massimo!

Categories: Uncategorized

Arduino and Two Stepper Motors

May 30, 2015 16 comments



This project consist in moving two stepper motors “simultaneously”.
Really there is a loop where both motors are moved “one step at a time” to reach their final position.
5 Volts steppers with external power source are used.


Here is the video in YouTube:

Here is the Sketch:


Two_Steppers.ino  30 MAY 2015

Driving two steppers concurrently with the Arduino Nano.
stepperX follows potentiometer on analog input 0.
stepperY follows potentiometer on analog input 1.
A timeout is used to turn off coils and save energy in battery
operated applications.

Arduino NANO.
Drivers: ULN2003A
Stepper Motors: 28BYJ48, 5VDC, step angle 5.625 °
                Gear reduction 64:1
                No-load starting frequency:> = 500PPS (4 rpm)
                Coil resistance 60 Ohms.               

#include <Stepper.h>

#define  STEPSREV    4096    // 64(fullsteps) * 64 (reduction ratio)
#define  SPEED       4       // motor speed (RPM)

#define  COIL_1X     11
#define  COIL_2X     9
#define  COIL_3X     10
#define  COIL_4X     8

#define  COIL_1Y     7
#define  COIL_2Y     5
#define  COIL_3Y     6
#define  COIL_4Y     4

#define  POT_X       0
#define  POT_Y       1                
#define  TIMEOUT     1000    //Turns off after 1 sec of inactivity.
#define  NOISE       8       //inmunity in steps because analog noisy readings.

// create the instances of the stepper class.
Stepper stepperX(STEPSREV, COIL_1X, COIL_2X, COIL_3X, COIL_4X);
Stepper stepperY(STEPSREV, COIL_1Y, COIL_2Y, COIL_3Y, COIL_4Y);

int potValX,potValY;           // potentiometers analog readings
int Xpos,Ypos;                 // Actual steppers positions(0-4096)->(0-360°)
int newXpos, newYpos;          // New steppers positions
unsigned long stampX, stampY;  // last move time stamped.

//============== functions ====================================================

//Read the potentiometers and map the reading to mach 360 degrees.
void readPots(){
  potValX = analogRead(POT_X);          // read POT_X value (0-1023).
  potValY = analogRead(POT_Y);          // read POT_Y value (0-1023).
  newXpos= map(potValX,0,1023,0,2047);  // Map pot X range to one stepper turn.
  newYpos= map(potValY,0,1023,0,2047);  // Map pot Y range to the stepper turn.
// Aproach stepperX to the newX position.
void aproachX(int newX){
  int Xdir = Xpos<newX ? 1 : -1;
  stepperX.step(Xdir);        // move one step in the Xdir direction.
  Xpos += Xdir;               // update Xpos.
  stampX = millis();          // stamp actual time.

// Aproach stepperY to the newY position.
void aproachY(int newY){
  int Ydir = Ypos<newY ? 1 : -1;
  stepperY.step(Ydir);        // move one step in the Ydir direction.
  Ypos += Ydir;               // update Ypos.
  stampY = millis();          // stamp actual time.

//Check for inactivity and turn off the steppers coils to save battery.
void CheckTimeout(){
  if((millis() - stampX) > TIMEOUT){   //Turn Off StepperX coils.
    digitalWrite(COIL_1X, LOW);
    digitalWrite(COIL_2X, LOW);
    digitalWrite(COIL_3X, LOW);
    digitalWrite(COIL_4X, LOW);
  if((millis() - stampY) > TIMEOUT){   //Turn Off StepperY coils.
    digitalWrite(COIL_1Y, LOW);
    digitalWrite(COIL_2Y, LOW);
    digitalWrite(COIL_3Y, LOW);
    digitalWrite(COIL_4Y, LOW);

//=================== setup ===================================================
void setup(){
  stepperX.setSpeed(SPEED);  // set the X motor speed.
  stepperY.setSpeed(SPEED);  // set the Y motor speed.
  Xpos = newXpos;
  Ypos = newYpos;

//================= main loop =================================================
void loop(){
//if diference is greater than NOISE move steppers.
  if(abs(newXpos - Xpos)> NOISE) aproachX(newXpos);
  if(abs(newYpos - Ypos)> NOISE) aproachY(newYpos);

  CheckTimeout();   //check for inactivity.









This is the beginning!

June 14, 2011 2 comments

Hello everyone!

I’m learning how to blog and the best way to show my Arduino projects.

Soon there will be news

Categories: Uncategorized