Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: March 18, 2013, 03:45:17 pm
izanette - I have never tested for precision.  However, I would prefer to see programmatic tests without using a potentiometer. For example, running a securely fastened  stepper via test software to a set-point position, mechanically marking the position, then pseudo-randomly run the stepper back and forth and finally return to the set-point position and verify its position to the previous mark.
2  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: March 13, 2013, 12:50:52 pm
sbright33 - re "What he said.  Seriously." No offence intended - your library and the empirical research behind it are commendable and it is just that your RPMs exceed the factory specifications and my personal experience. I have never tried running that stepper on 12V nor the resistors and capacitors. Maybe I'll try it when the time is available (if I can dig up a suitable 12V PS). I do have copies of your step1a.pde and step1p1dps.pde. Is there another version that I should try instead?
3  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: March 13, 2013, 09:13:49 am
If you are using the code in my December 31, 2011 post the variable "motorSpeed" controls the speed since it is used for the "delay" value between steps.
If your goal is to increase speed, remember that this stepper is geared down with a 1:64 ratio - so it will never spin very fast. That said, it can be improved with a different library - see my post of January 17, 2012, 10:14:20 AM - try the AccelStepper library mentioned there. The VIDEO at that post shows the AccelStepper in use - your stepper should turn at least this fast.

The AccelStepper Library has speed() and runSpeedToPosition() functions that may give you what you want. While the AccelStepper Library supports a maximum stepping speed to about 4kHz, the 28YJ-48 supports a maximum no-load step rate of 900pps (less that 1kHz).

The 28BYJ-48 has a step angle of 5.625°/64. Therefore, one full rotation requires 4,096 steps. At 900pps (with simultaneous port writes as mentioned in the post of Reply #19 on: January 14, 2012, 10:17:55 AM) the maximum rotation speed computes to 13rpm (unless my math was wrong) - (900/((360/5.625)*64))*60. However, look back in this thread and you'll see that sbright33 says that he can achieve 35rpm. I don't see how this is possible but that is what he says. Please note, however, that he is running the stepper with 12VDC and he has to de-power it when idle to avoid overheating, so he is driving the stepper very hard.

As to speed, remember that this stepper was designed to move the vents on air conditioners, that are popular in Asia, with a goal of high torque not high speed.

Good luck with your experiments.
4  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: March 10, 2013, 01:51:22 pm
A breadboard power supply. The stepper draws too much current to run from the USB port. The power supply was purchased over eBay and is similar to these:
5  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: March 10, 2013, 11:06:38 am
Sharonf, you can see a video of a "real" functioning  28BYJ-48 5-Volt Stepper circuit on YouTube - at

If you pause the video you'll be able to see the wiring. It is using an Arduino NANO
6  Using Arduino / Networking, Protocols, and Devices / Re: openWRT + Arduino UNO R3 /dev/ttyACM0 on: February 28, 2013, 11:08:53 pm
GR0B - Did you get this working?? I am trying to interface a TL-WR703N to an Arduino NANO (same hardware as UNO) and even with the usb-acm package installed no ttyACM is created.
7  Community / Exhibition / Gallery / FYI - Arduino to Linux serial communications on: December 04, 2012, 03:45:20 pm
FYI - A recent project was to test and characterize the performance of a bag of inexpensively obtained LDRs (Light Defined Resistors). These particular LDRs were a special assembly of a GL5528 LDR, infrared blocking glass filter and a rubber housing. They are specifically designed for video camera use. I created a dark chamber (a shoebox) with a white-light LED at one end and the subject LDR at the other. The Arduino NANO controls the white-light LED and measures the LDR at various light levels. The test data is output over the Arduino serial port to a shell script running on my Linux desktop. The shell script accepts a file creation name, restarts the Arduino and captures the Arduino's serial output into a file. When the Arduino signals that its data set is complete, the Linux shell script draws a line graph of the LDR's performance curve with a second line of a control performance.

I paste the code of the whole thing in hopes that someone may see something within that will help them in their own project. If you want to read more about my LDR project, refer to my blog:

 ** Plot photoresistor(LDR) response curve
 ** Edward I. Comer December 2012
// Defines
#define DELAYTIME 10000 // Delay 10 seconds
#define MAXLIGHTLEVEL 25 // Max brightness level
#define STARTLIGHTLEVEL 9      // Starting point
#define INCREMENT 1 // increment to boost light

// constants won't change. Used here to
// set pin numbers:
const int localLEDPin =  13;         // the number of the LED pin
const int ldrPin = 1;                // pin number with LDR
const int lightPin = 3;              // pin for flashlight
int LightLevel = STARTLIGHTLEVEL;    // light brightness 0-to-255
int ldrValue = 0;                    // Value read

void setup() {
    // set the digital pin as output:
    pinMode(localLEDPin, OUTPUT); // set pin 13 as output
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
    //  Serial.println("ldrtest.ino running");
    //  Serial.println("waiting 60 seconds");
    analogWrite(lightPin,0);    // settle at starting light level
    delay(10000); // wait 10 secs for LDR to settle
    //  delay(30000); // wait 30 secs for LDR to settle
    //Serial.println("\"Light value\",\"LDR value\"");

void shutdown()
    analogWrite(lightPin,0); // Turn light off
    Serial.write(0x0a); // newline character for Linux
    // Rapid blink indicates completion of test
    while(1){  // endless loop
        digitalWrite(localLEDPin, HIGH);   // sets the LED on
        delay(500);                  // waits for a second
        digitalWrite(localLEDPin, LOW);    // sets the LED off
        delay(500);                  // waits for a second

void loop()
    // Turn on local LED to indicate test start
    digitalWrite(localLEDPin, HIGH); // local LED on
    analogWrite(lightPin,LightLevel); // set light brightness
    delay(DELAYTIME); // wait for LDR to settle
    ldrValue = analogRead(ldrPin); // read LDR value
    // Turn on local LED to indicate test stopped
    digitalWrite(localLEDPin, LOW); // local LED off

    Serial.print(LightLevel, DEC); // Print CSV format X-axis
    //Serial.print(", ");
    Serial.print(" ");
    Serial.print(ldrValue, DEC); // Print CSV format Y-axis
    Serial.write(0x0a); // newline character for Linux

    LightLevel += INCREMENT; // increment light brightness
    if(LightLevel > MAXLIGHTLEVEL){
    LightLevel &= 255; // limit variable to 1-byte
# Acquire LDR data and plot results from Arduino script ldrtest.ino
# Reads two column data from Arduino into a file, then
# creates a graph using gnuplot
# NOTE: stty raw keeps port open
# Edward Comer - December 2012
echo -n "Type device name and press [ENTER]: "
read device
echo -n > ${device}.txt

# Toggle DTR to restart Arduino, then set baud=9600 and RAW mode to keep port open
stty -F /dev/ttyUSB0 hupcl
stty -F /dev/ttyUSB0 cs8 9600 raw ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

# Read Arduino serial port until text END is received
while read line; do
     if [ "$line" != "END" ]; then
          echo "$line" >> ${device}.txt
 echo "Received $line"
done < /dev/ttyUSB0

# create gnuplot graph of LDR results
echo Plotting $device.txt
gnuplot -e "source=\"$device.txt\"; set output \"$device.png\""
echo Graph "$device.png" created
# Display plot on screen
eog "$device.png"
set terminal png nocrop font small size 1024,768
set title "LDR Response"
set xlabel "LIGHT-SETTING"
set ylabel "LDR-VALUE"
set grid
plot  source using 1:2 with linespoints notitle , "control.txt" using 1:2 with linespoints title "Control"

# control data set for GL5528 LDR
9 1015
10 996
11 841
12 431
13 188
14 96
15 51
16 42
17 37
18 34
19 31
20 30
21 23
22 22
23 23
24 22
25 22

8  Development / Other Hardware Development / Re: gEDA (gschem/pcb) symbol/footprint for Arduino on: November 19, 2012, 06:38:48 pm
Thanks! As an avid user of gEDA I appreciate your contribution.
9  Community / Products and Services / Re: PCB fab service in UK - is there one? on: August 08, 2012, 10:15:20 pm
I just used a Chinese company, DFROBOT, that just started offering PCB service. They are an robot and Arduino focused company and the PCBs are aimed at small quantity. I live in the USA but the Chinese would, of course, ship to the UK. They were fast - 10 days from me emailing my gerbers to delivery at my door. The boards are very good quality. I have attached a photo of the front/back of my 60mm round board with a large hole in the middle. Including DHL shipping each board cost $3.39USD.

They require the gerber files to be in a very specific format. I use gEDA's PCB software and I wrote a simple script to rename the gerber files to match what DFROBOT wants. No problems!!
10  Using Arduino / Sensors / FYI: Interfacing Wireless Remote Control Sensor PT2262 / 2272 SC2272 on: July 08, 2012, 11:21:30 am
Lately I have been experimenting with wireless sensors that use the PT2262/2272 integrated circuits. These chips are common in inexpensive, Chinese manufactured security alarm sensors, such as PIR Motion Detectors, door-open sensors, smoke alarms, keychain-fob remote controls, etc. Just seach eBay with "wireless alarm sensor My99" and you'll see a slew of what I am talking about.

I recently obtained, for about $7US e/w delivery, a 433MHz receiver e/w SC2272-T4 decoder and an associated keychain fob wireless remote control with four data buttons. I realize that the 2262/2272 protocol can be simulated in code (see the RC-SWITCH project) but I prefer that the protocol be in hardware so as to limit code-bloat, although I did test RC-SWITCH (see bottom of post). I don't really like that the SC2272-T4 in my unit is a toggle version. There are both Momentary and Latched versions of the same module, ironically,  available under the same name - R06A

You can see a YouTube video of my experiment with the 2272 wireless receiver and keychain fob at YouTube-Link.

If you are interested in more of the technical details of the 2262/2272 chipset, read my blog post titled "Wireless Remote Control PT2272 for Arduino".

The same code can be used for any of the aforementioned 2262-based sensors.

The YouTube video polled the receiver's ports. The improved code below uses interrupts.
** Test of R06A RF decoder e/w SC2272-T4
** This example uses a SainSmart I2C LCD2004 adapter for HD44780 LCD screens
** LCD2004 Address pins 0,1 & 2 are all permenantly tied high so the address
** is fixed at 0x27
** Written for and tested with Arduino 1.0
** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)
** NOTE: Tested on Arduino NANO whose I2C pins are A4==SDA, A5==SCL
**       INT0 is on D2
** Wiring for Nano: A4->SDA, A5->SCL
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

// These pins are on the PCF8574 I/O expander for I2C-bus, not the nano
#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

#define  LED_OFF  0
#define  LED_ON  1

#define PIN_D2_INT 0

// R06A defines - wired to Digital Arduino pins
// Wire the R06A per this assignment
#define R06A_VT 2    // used for INT0
#define R06A_D0 3
#define R06A_D1 4
#define R06A_D2 5
#define R06A_D3 6

int r06a_0, r06a_1, r06a_2, r06a_3 = 0; // storage for data states
int dirty = 0;                        // interrupt has occurred flag

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

// Interrupt Service Routine attached to INT0 vector
void pinD2ISR()
    // Provide a visual clue of the interrupt
    digitalWrite(13, !digitalRead(13));  // Toggle LED on pin 13
    // Grab the data states
    r06a_0 = digitalRead(R06A_D0);      // Grab data for later consumption in loop()
    r06a_1 = digitalRead(R06A_D1);
    r06a_2 = digitalRead(R06A_D2);
    r06a_3 = digitalRead(R06A_D3);
    dirty = 1; // flag interrupt occurance

void setup()
  lcd.begin (20,4);
// Switch on the backlight
  lcd.home ();                   // Home
  lcd.print("Test of R06A Decoder"); // Logo 1st line
  lcd.setCursor ( 0, 2 );         // Go to the 3rd line
  lcd.print("DAT3 DAT2 DAT1 DAT0");
  attachInterrupt(PIN_D2_INT, pinD2ISR, RISING); // Set D2 interrupt
  // setup the R06A decoder connections
  pinMode(R06A_D0, INPUT);
  pinMode(R06A_D1, INPUT);
  pinMode(R06A_D2, INPUT);
  pinMode(R06A_D3, INPUT);

void loop()
dirty = 0; // clear interrupt occurance flag
lcd.setCursor (15,3);     // go to LCD col 15 of line 4
lcd.print(r06a_0 ? "HIGH": "LOW ");
lcd.setCursor (10,3);     // go to LCD col 10 of line 4
lcd.print(r06a_1 ? "HIGH": "LOW ");
lcd.setCursor (5,3);      // go to LCD col 5 of line 4
lcd.print(r06a_2 ? "HIGH": "LOW ");
lcd.setCursor (0,3);      // go to LCD col 0 of line 4
lcd.print(r06a_3 ? "HIGH": "LOW ");

I did test the RC-SWITCH software using a plain 433MHz receiver. I compiled the test code “ReceiveDemo_Advanced.pde” and when I press the keychain-fob’s “A” key, the output is:

Decimal: 5227968 (24Bit) Binary: 010011111100010111000000 Tri-State: F01110FF1000 PulseLength: 451 microseconds Protocol: 1 (plus the raw data)

When I paste the raw data into Sui’s RC-SWITCH visualization tool at the attached waveform in is the result. If you decode it you’ll see that it matches “F01110FF1000″. Pressing the “B” key yields “F01110FF0100″, the “C” key “F01110FF0010″ and the “D” key “F01110FF0001″. You can clearly see that the least significant digits are the data field with the “D” key being the least significant. The address field is “F01110FF” which matches the solder pads on my key-chain fob used for the tests.
11  Topics / Home Automation and Networked Objects / Re: Controlling Remote Controlled Sockets (SC2262 emulation by Arduino) on: June 25, 2012, 08:36:45 am
CaptainIffy - Thanks for this post. It is very informative. Have you done any work on the receive side of things? My planned project is the opposite of your work - I want to handle the receive side of things. Specifically, I want to use an Arduino to receive 433MHz transmissions from a remote keyfob that uses a SC2262 chip. The specific keyfob that I am going to use costs under $8US and is commonly sold on eBay and included with cheap Chinese alarm systems, also sold on eBay. I have attached a photo of the target keyfob.
12  Using Arduino / Interfacing w/ Software on the Computer / Re: Cheap Serial Interface on: May 30, 2012, 07:55:47 am
Rifqi - re-read my original post. I said "To order one just search for "USB 2.0 to UART TTL 6PIN Module Serial Converter CP2102" on eBay."

I said that they are made by but did not say to buy them there.

Also - be aware that these boards do not use the standard FTDI pinout. Therefore, they are used to communicate with an Arduino but do not have the Automatic (Software) Reset used for sketch loading. Some people modify this board to provide the Automatic (Software) Reset, but you need to be somewhat hardware savvy to do this modification unless you purchase one of the CP2102 board versions that have the DTR brought out to an edge pin. Otherwise, more daunting surface mounted pin surgery is required. The easiest thing to do is to simply use this el-cheapo board for communications, not programming.
13  Using Arduino / Displays / Re: problem with serial lcd from YwRobot, LCM1602 IIC on: May 19, 2012, 08:09:49 pm
I am having problems with the same Ywrobot card on the back of a 20X4 display. Mine was sold by SainSmart but the provided code is marked Ywrobot. All I see is garbage characters for 2 lines.

Your problem is because the library provided by Ywrobot is for pre-1.0 Arduino. I have tried both the "official" I2C library and F Malpartida's NewLCD I2C library. I cannot display anything but garbage.
14  Using Arduino / Programming Questions / [SOLVED] Re: ATtiny85 SoftSerial known to work? on: April 30, 2012, 10:52:38 am
Thanks for the reply. I should have updated my original POST as I resolved the issue using the standard version 1.0 SoftwareSerial.h (formerly NewSoftSerial.cpp), the Multi-instance software serial librarywith Interrupt-driven receive and other improvements by ladyada (

It works fine with both ATtiny85 and ATtint84 chips.

FYI - I did find that I needed diode isolation (I used 1N4148) on the Rx line of the ATtiny chips when using my CP2102 based serial cable (anode towards the ATtiny Rx pin). Without the diode isolation the serial line would be all noise if booted while connected.
15  Using Arduino / Displays / Re: Shift Register Libraries for LCD Displays on: April 12, 2012, 09:37:01 am
I don't know what you are referring to with a "decoupling cap between pins 12 and 13". The only capacitors that I use are between the power and ground pins, as close to the chips as possible. I attached, to this post, a copy of the schematic of my ATtiny85 2w-LCD circuit. You can see the capacitor placement.
Pages: [1] 2 3 4