Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Re: Project: Motion Detector Water Cannon on: January 20, 2013, 11:29:14 pm
I've some code that might do what you're looking for. It uses an Arduino to control the servos, while a Processing sketch on a laptop uses a webcam to track moving targets. It doesn't have any sort of internet control, but since it can run fully autonomous, you might not need to control it manually at all.
Here's a link to the project page (click "Download Code" on the left for the Arduino & Processing code):
Good luck!
2  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega 2560 will not run Blink.ino on: June 19, 2012, 04:43:33 pm
Scratch that.... issue just showed up again.

I had done several cycles of code work, upload, test, repeat, and all was going well. Uploads were going fine, and the Arduino Mega was running the code just fine.
Then out of the blue, the same symptoms from the first post above showed up again. The only thing I could think of was that a mistake in my code had caused the issue, so I went back and uploaded the last known working version of the code to the Mega. Unfortunately, the issue persisted. Then I re-installed the Arduino IDE, because that seemed to fix the issue last time - not this time though. I'm back where I started here, completely clueless.

Anybody have ideas? Thanks!
3  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega 2560 will not run Blink.ino on: June 19, 2012, 03:00:36 pm
Still not sure what the issue was, but I downloaded the newest version of the Arduino IDE (switched from 1.0 to 1.0.1), and my Mega seems to be working OK now. Hope that helps anybody else with the same issue.
4  Using Arduino / Installation & Troubleshooting / Arduino Mega 2560 will not run Blink.ino on: June 18, 2012, 01:42:43 pm
Hey all,

I have an Arduino Duemilanove and an Arduino Mega 2560. Up until today, both have always worked fine. I've been working on a project over the past few days, but when I plugged in the Mega today, it just would not run the sketch I had been working on.

The sketch uploads (pin 13, RX and TX LED's flash in the usual pattern), and the Arduino IDE says "Done Uploading" with no errors. I went back and tried the Blink.ino example sketch, and even that doesn't work. As above, the upload seems to go fine, based on the LED's and message in the IDE. If I manually reset the Arduino after uploading by pressing the reset button, I get the usual two blinks on pin 13, then nothing after that. As far as I can tell, the sketch just will not run. I also tried the BlinkWithoutDelay example, and got the same results.

To check that the IDE and my computer were fine, I uploaded the Blink sketch to my Duemilanove, and it runs fine there - pin 13 is blinking away happily on the Duemilanove. I also verified the serial connection to the Mega with the loop-back test from,73748.0.html.

Something I noticed, is that if I open the Serial Monitor from the IDE when the Arduino Mega is plugged in, pin 13 lights up and stays lit until I close the Serial Monitor. Odd, since it should be blinking according to the Blink.ino sketch, whether the Serial Monitor is open or not. Not sure what this means.

More info:
-Windows 7 64-bit
-Arduino 1.0 IDE
-Arduino Mega 2560 R2
-Yes, I have the proper board ("Arduino Mega 2560 or Mega ADK") and serial port selected in the Tools menu.
-No external circuitry or wires connected aside from the USB cable

Anybody have an idea of what is causing this issue? I am inclined to believe that the bootloader is OK, because the upload appears to be working. I would say that I'm fairly experienced with Arduino, but this is something I've never seen before.

5  Topics / Device Hacking / Arduino to Printer through Parallel Port on: October 08, 2011, 06:12:16 pm
Looking around on the forums for some hints on this topic, and finding none, I worked out the details from scratch. I figured somebody else might want to do this someday, and so if that's you, here's what worked for me. Hope it helps.

The goal is to use an Arduino to control an HP printer. We are talking standard, desktop printers here, not thermal-receipt-printers or 3D printers.
The printer in question needs to have a parallel/centronics port ( I used an HP Deskjet 952C; the protocol should work with most similar HP printers. No promises for non-HP, but it's worth a try.

The port on the printer is actually called a Centronics connector. If you have a cable to connect the printer to the computer, look at the other end - this is the actual parallel port type connector. You can wire in your Arduino at either end, but the pin-outs are slightly different depending on which end you use:
Pin # (Parallel Port Connector)        Pin # (Centronics Connector)        Signal Name        Signal Type       
22Data pin 0(input)
33Data pin 1(input)
44Data pin 2(input)
55Data pin 3(input)
66Data pin 4(input)
77Data pin 5(input)
88Data pin 6(input)
99Data pin 7(input)
18-2519-30Ground (-) 

Connect each of these pins to your Arduino as follows (I did this by splicing into the wire, but there's probably better methods):
nStrobe -> arduino pin 2
data_0 -> arduino pin 3
data_1 -> arduino pin 4
data_2 -> arduino pin 5
data_3 -> arduino pin 6
data_4 -> arduino pin 7
data_5 -> arduino pin 8
data_6 -> arduino pin 9
data_7 -> arduino pin 10
nAck -> arduino pin 11
busy -> arduino pin 12

It's that simple. Now just run this code on the Arduino:
const int startup_charsPerLine = 80;
const int startup_num_lines = 2;
byte startup_message[startup_num_lines][startup_charsPerLine] = {
  "This is the startup message. It prints whenever",
  "the Arduino is reset.",

const int charsPerLine = 80;   // this is the max # of chars per line
const int num_lines = 10;
byte message[num_lines][charsPerLine] = {
  "    ",   // blank line
  "This is the normal message. It prints whenever",
  "you connect pin 14 (analog 0) to GND.",
  "  ",  // blank line
  "------------------------------------------------------------------------------",   // a spiffy line
  "1) More message content",
  "  ",
  "II) you can have up to about 80 chars per line ",
  "  ",

// parallel port pin# = arduino pin#
const int nStrobe = 2;
const int data_0 = 3;
const int data_1 = 4;
const int data_2 = 5;
const int data_3 = 6;
const int data_4 = 7;
const int data_5 = 8;
const int data_6 = 9;
const int data_7 = 10;
const int nAck = 11;
const int busy = 12;

const int strobeWait = 2;   // microseconds to strobe for

void setup() {

  pinMode(nStrobe, OUTPUT);      // is active LOW
  digitalWrite(nStrobe, HIGH);   // set HIGH
  pinMode(data_0, OUTPUT);
  pinMode(data_1, OUTPUT);
  pinMode(data_2, OUTPUT);
  pinMode(data_3, OUTPUT);
  pinMode(data_4, OUTPUT);
  pinMode(data_5, OUTPUT);
  pinMode(data_6, OUTPUT);
  pinMode(data_7, OUTPUT);

  pinMode(nAck, INPUT);     // is active LOW
  pinMode(busy, INPUT); 

  pinMode(13, OUTPUT);
  pinMode(14, INPUT);   // analog pin 0 on duemilanove and uno
  digitalWrite(14, HIGH); // enable pull-up
  Serial.println("Delay for 5 sec");
  Serial.println("Startup complete");

void loop() {
 while(digitalRead(14) == HIGH) {
   // wait




void printByte(byte inByte) {
  while(digitalRead(busy) == HIGH) {
    // wait for busy to go low

  int b0 = bitRead(inByte, 0);
  int b1 = bitRead(inByte, 1);
  int b2 = bitRead(inByte, 2);
  int b3 = bitRead(inByte, 3);
  int b4 = bitRead(inByte, 4);
  int b5 = bitRead(inByte, 5);
  int b6 = bitRead(inByte, 6);
  int b7 = bitRead(inByte, 7);

  digitalWrite(data_0, b0);        // set data bit pins
  digitalWrite(data_1, b1);
  digitalWrite(data_2, b2);
  digitalWrite(data_3, b3);
  digitalWrite(data_4, b4);
  digitalWrite(data_5, b5);
  digitalWrite(data_6, b6);
  digitalWrite(data_7, b7);

  digitalWrite(nStrobe, LOW);       // strobe nStrobe to input data bits
  digitalWrite(nStrobe, HIGH);

  while(digitalRead(busy) == HIGH) {
    // wait for busy line to go low

void resetPrinter() {
  Serial.println("Reseting printer...");
  printByte(27); // reset printer
  Serial.println("Printer Reset");

void printMessage() {
  digitalWrite(13, HIGH);
  for(int line = 0; line < num_lines; line++) { 
    for(int cursorPosition = 0; cursorPosition < charsPerLine; cursorPosition++) {
      byte character = message[line][cursorPosition];
    printByte(10); // new line
    printByte(13); // carriage return

void printStartupMessage() {
  Serial.println("Print start-up mssage");
  digitalWrite(13, HIGH);
  for(int line = 0; line < startup_num_lines; line++) { 
    for(int cursorPosition = 0; cursorPosition < startup_charsPerLine; cursorPosition++) {
      byte character = startup_message[line][cursorPosition];
      //      delay(1);
    printByte(10); // new line
    printByte(13); // carriage return
    Serial.print("Line ");
    Serial.println(" printed.");
  Serial.println("Startup message printed");

It should print the startup message when the Arduino is turned on or reset. To print the other message, briefly connect pin 14 (analong 0 on Arduino Uno) to GND.
Keep in mind that the printer needs to be on, that means plugged into an outlet. The Arduino will not power the printer.

If you are successful getting your printer working with the Arduino, please let us know what model of printer it was, and any tips. If you have any questions, feel free to ask.

6  Using Arduino / Networking, Protocols, and Devices / Re: Interfacing Mega ADK with HP usb printers on: October 08, 2011, 05:22:31 pm
If the printer has a Parallel Port, you can use that to print with an Arduino. I have some code that does this.
7  Topics / Robotics / MOSFET's? on: May 08, 2011, 08:23:04 pm
Anybody have suggestions for MOSFET transistors that work with the 5V from an Arduino? I'm looking for something from DigiKey or Mouser.

I read that part# FQP50N06L from Fairchild was 'logic-level', but I am new to datasheets, and I'm not sure what to look for.

8  Topics / Robotics / BeagleBoard and Arduino for Sentry Gun? on: March 22, 2011, 07:34:42 pm
Hey everybody,

Looking for some advice. My project so far is a working sentry gun:
It can track motion, using Processing, with a webcam and laptop. I use an Arduino to control servos for aiming, as well as reading a few inputs.

Everything works so far. But I want to remove the laptop from the system. There is some hefty vision processing going on, so I know an Arduino couldn't handle the job alone. My question is this: what is the best solution for small, portable computing? I'm thinking something along the lines of a BeagleBoard, but really I'm not sure what to use.

  • Read a webcam at standard defintion
  • Execute a Processing sketch to do vision processing
  • Communicate with an Arduino over serial / usb
  • It does NOT need to hookup to a monitor or screen

Any suggestions? Does anybody else have experience with devices like this?

9  Using Arduino / Interfacing w/ Software on the Computer / Re: After uploading a program to send data on the USB I can't reprogram it anymore on: March 16, 2011, 04:07:51 pm
Well, first of all make sure you close the serial monitor before you try to upload the new code.
I've run into this once or twice with home brewed serial code. Still don't know what exactly causes it, but what solved the issue for me was holding the reset button on the Arduino, and then releasing it just before the new code was uploaded. Might take a couple tries to get the timing right. You want the Arduino to be on by the time the new code begins to upload, but not to have started running its own code yet.
Also, stick a 1-second delay in setup() so you can do this more easily next time.
10  Using Arduino / Motors, Mechanics, and Power / Re: Building a Winch. Stepper motor or regular DC motor. on: March 16, 2011, 04:00:57 pm
But for simple, precise speed control of a DC motor, you can use an H-Bridge or MOSFET, taking a PWM signal from the micro controller.

The speed of normal motors increases and decreases with the change in load, so more than this will probably be needed.

Good point. But if the load was always 40 lbs, the motors would always move it at the same speed, right?
11  Using Arduino / Motors, Mechanics, and Power / Re: Building a Winch. Stepper motor or regular DC motor. on: March 13, 2011, 02:30:10 pm
Like you said, position/speed feedback from the shaft would help a lot. But for simple, precise speed control of a DC motor, you can use an H-Bridge or MOSFET, taking a PWM signal from the micro controller.
12  Using Arduino / General Electronics / Re: 2.5V input using pull-up? on: March 13, 2011, 02:19:53 pm
Thanks for all the advice. The sensor was a an old fiber-optic sensor I scrounged up, I don't have any part number for it though.
I tried it on a digital pin with no pull-up, and it skipped around between low and high, like some of you predicted. I tried with the internal pull-up and it stayed high.
In the end, I just used an analog input pin, but thanks again!
13  Using Arduino / General Electronics / 2.5V input using pull-up? on: March 04, 2011, 09:08:50 pm
Hey everybody,
I have a sensor that outputs a 2.5v-true and 0v-false signal. I want to read this signal with a digital Input on my Arduino.
Can I use a the internal pull-up resistor on the digital I/O pin, to make the 2.5v read HIGH, and the 0v read LOW?
14  Using Arduino / Interfacing w/ Software on the Computer / Re: need some help with my project on: February 05, 2011, 04:50:59 pm
I tried this once, it puzzled me for a long time. The solution is simple, I think, you just have to power the servo motors from a seperate battery than the Arduino. This is becasue the pulseIn() command, for some weird reason, gets messed up when the Arduino is powering servo's.

And remember to connect the ground of the servo power source to the arduino ground!

Hope that helps!
15  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Communication with PC Software problem on: February 05, 2011, 04:46:35 pm
It might help if we could see the code you are running on the PC.

Do you have the PC software set to use the right baud rate?
Are you sending the #:GS# request in the correct datatype (byte, DEC, HEX, etc.)

Pages: [1] 2