Arduino Ethernet Shield Client and Server

Arduino Ethernet Shield Client and Server

I want to share a project that uses two Arduinos to communicate over LAN as a client and server.  These two sketches were made for a pan/tilt controller, but you can modify the code to send other data. Client: /* * * This program controls the Bescor MP&minus;101 Pan/Tilt system via Ethernet * * Copyright (c) 2012 Matt Alford, http://www.protechy.com * Date: Sep 15, 2012 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses></http:>. */ #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xXX, 0xXX }; //assign arduino mac address byte ip[] = { xxx, xxx, x, xx}; // ip in lan assigned to the arduino //byte gateway[] = { xxx, xxx, x, x }; // internet access via router //byte subnet[] = { xxx, xxx, xxx, x }; //subnet mask EthernetServer server(8888); //server port of the arduino EthernetClient client; byte serverName[] = { xxx, xxx, x, xx }; // (IP) Arduino server IP address #define up 9   #define down 3   #define...
Bescor MP-101 Remote Development

Bescor MP-101 Remote Development

Update Oct 20, 2012: I’m holding this project off.  I had a few questions about the pan/tilt speed of the Arduino remote vs the original remote.  The pan/tilt speed is reduced, but because we’re changing the original values designed for the motors, it could cause the motors to stall.   We’ve been using the Arduino Uno and Bescor MP-101 for a while now, and I’ve learned a lot, but now I’m ready to develop a Bescor Joystick Remote without the Arduino Uno.  If things come together with a little help and support, I want to implement a wireless solution using a smart phone.  In the meantime, I want to thank those of you for letting me see your cool pan/tilt projects.    ...
Bescor MP-101 and Arduino v2.4

Bescor MP-101 and Arduino v2.4

  This code is slightly modified to keep the motors from stalling when they run back and forth, but it appears the problem is something to do with motors going to ground. /* * * This program controls the Bescor MP-101 Pan/Tilt system using the Wii Nunchuck * * Copyright (c) 2012 Matt Alford, http://www.protechy.com * Date: Aug 14, 2012 * * Nunchuck Library http://playground.arduino.cc/Main/WiiChuckClass * */ #include "Wire.h" #include "WiiChuck.h" // The library used by the Nunchuck #define left 11 //Pin 11 controls left pan #define right 3 //Pin 3 controls right pan #define up 10 //Pin 10 controls up tilt #define down 9 //Pin 9 controls down tilt WiiChuck chuck = WiiChuck(); int varx = 0; // The x-axis variable to store the value coming from the Nunchuck int vary = 0; // The y-axis variable to store the value coming from the Nunchuck int absx = 0; // The x-axis variable used to store the absolute value. int absy = 0; // The y-axis variable used to store the absolute value. void setup() { Serial.begin(115200); // Opening the serial port //TCCR2B = TCCR2B & 0b11111000 | 0x07; //Adusting PWM frequencies for testing pins 11 and 3 //TCCR1B = TCCR1B & 0b11111000 | 0x05; //Pins 9 and 10 // nunchuck_setpowerpins(); // use analog pins 2 & 3 as gnd & pwr (uncomment to use WiiChuck) chuck.begin(); chuck.update(); } /* //To power the WiiChuck Adapter static void nunchuck_setpowerpins() { #define pwrpin PORTC3 #define gndpin PORTC2 DDRC |= _BV(pwrpin) | _BV(gndpin); PORTC &=~ _BV(gndpin); PORTC |= _BV(pwrpin); delay(100); // wait for things to stabilize } */ void loop() {...
Bescor MP-101 and Arduino: Update

Bescor MP-101 and Arduino: Update

  I’m retiring this project for now and encourage anyone to continue improving the Bescor MP-101 and Arduino, but in the meantime stay tuned for a really cool project involving Opentld and the Arduino.   Known issues: The Bescor sometimes stalls under reduced...
Bescor MP-101 and Arduino v2.1

Bescor MP-101 and Arduino v2.1

New code here v2.4 On v2, I didn’t assign all the directional wires PWM pins, and it caused me to use the purple wire as speed which was unnecessary.  In v2.1 the speed and direction come from the direction wires.  Also, I learned from this link the Bescor goes to ground at limit which means it will stop moving overtime when it goes in two directions.  By using 1.5k resistors on each end of the four wires, the Bescor doesn’t reach the ground limit. White = up Blue = down Yellow = left Green = right White = pin 10 Blue = pin 9 Yellow = pin 11 Green = pin 3 The Bescor had a lot of electrical noise, so I changed the PWM frequency using this code.   /* * * This program controls the Bescor MP-101 Pan/Tilt system using the Wii Nunchuck * * Copyright (c) 2012 Matt Alford, http://www.protechy.com * Date: June 23, 2012 * * Nunchuck Library created by Gabriel Bianconi, http://www.gabrielbianconi.com/ * */ #include "Wire.h" #include "ArduinoNunchuk.h" // The library used by the Nunchuck #define left 11 //Pin 12 controls left pan #define right 3 //Pin 10 controls right pan #define up 10 //Pin 9 controls up tilt #define down 9 //Pin 8 controls down tilt ArduinoNunchuk nunchuk = ArduinoNunchuk(); int varx = 0; // The x-axis variable to store the value coming from the Nunchuck int vary = 0; // The y-axis variable to store the value coming from the Nunchuck int absx = 0; // The x-axis variable used to store the absolute value. int absy = 0; // The y-axis...