Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Upload over ethernet on: May 14, 2013, 10:33:37 am
Hi all

Looking for some help please.  Using an Arduino Uno and an Ethernet Shield (R3) I've followed the instructions at http://www.freetronics.com/pages/how-to-upload-a-sketch-to-your-arduino-via-a-network#.UZJYeLUXaSp to enable uploading of a sketch over my local lan.  Everything seems to work fine except when there is a SD card in the slot -this stops the bootloader loading (and therefore accepting a new sketch).  I have to pop the SD card for it to continue.

Anyone encountered this?  Is it fixable?
2  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 01:44:51 pm
Thank you Coding Badly - I should have remembered that.

Everything going very hazy as I try to work out the pin mapping from the ATtiny84 to the Arduino Uno... 
3  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 09:21:00 am
My problem just got a whole lot bigger!

In my haste to follow your last instruction I left the 'enable' wire disconnected from the Attiny48.  So in theory without that pulse the motor won't run... guess what.. it still runs!  So now I'm totally clueless.  The L293D needs Enable 1 (pulsing to control speed) and either OUTPUT 1 or 2 HIGH to drive the motor.
Somehow or other I don't need to ENABLE and it still bloody runs.

Feeling totally stupid and lost now!
4  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 07:26:59 am
Hi Geoff

so the line of code

const int enable = 6;         // motor pulse pin

should read what?  and what physical pin should the wire be attached to on the ATTINY84?

Really appreciate your help.

regards Roddy
5  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 06:42:59 am
Just re-read your post.  To clarify 'enable' isn't on D6 its on PA6 or PA7 - tried both.  regards Roddy
6  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 06:40:56 am
Thanks Geoff, I understand what you are saying re init() however the reference you give for the ATTINY84 suggests that PWM is available on those pins marked with an asterics...PA5,6,7 and PB2?

7  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 19, 2012, 05:58:57 am
Thanks for the input....

I tried setting enable as an OUTPUT

pinMode(enable, OUTPUT);

no change.  I didn't think PWM pins needed to be set.

On the other suggestion....

i = 255.  I want to be able to vary this value to set an optimum speed for the motor.  The problem is that only i = 255 works!  Any other value doesn't.  This is the value that is send to the 'enable' Pin to set the pulse width....  I don't understand what you "in init ()" does?
8  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 18, 2012, 04:53:47 pm
ignore the two lines with

const INT enable = pin 6;

cut'n'paste error on my part
9  Using Arduino / Microcontrollers / Re: ATTINY84 PWM on: November 18, 2012, 04:51:11 pm
Code attached below.  Don't think this a coding issue - as it works on the UNO - with different pin assignments...  the code is very BASIC!  I'm new to all of this.  Apols for the structure etc....

In case its not obvious the code drives a motor which raises and lowers a chicken house door dependent on light.


int photocellReading;         // var for ldr reading
int sw_level = 340;           // light level for switching

int doorstate = 0;            // is the door open or closed 1=closed 0=open
int x = 1;                    // used to ensure motor keeps running once activated
int time = 0;                 // used to wait until after dark and not close immediately
int i=255;                    // motor speed 35 is slowest, 255 fastest
const int photocellPin = 0;   // ldr on A5 - don't use A0 or A1 with motorshield.
const int doordownPin = 1;    // door closed switch input pin
const int doorupPin = 2;      // door open switch input pin
const int enable = 6;         // motor pulse pin
const int forward = 4;        // motor direction
const int reverse = 5;        // motor direction
const int enable = 6;         // motor pulse pin

void setup() {
  pinMode(reverse, OUTPUT);       // Initiates Motor Channel A pin
  pinMode(forward, OUTPUT);       // Initiates Brake Channel A pin
  pinMode(doorupPin, INPUT);      // Door Up Switch is an input
  pinMode(doordownPin, INPUT);    // Door Down Switch is an input

 }

void loop() {
 photocellReading = analogRead(photocellPin);
  if ((photocellReading < (sw_level)) && (doorstate != 1)) {(time = time + 1);}
  if (photocellReading >sw_level) (time = 0);
  if (photocellReading > (sw_level))  {(doorup());}  // goto doorup
  if ((photocellReading < (sw_level)) && (doorstate != 1) && (time >= 3)) {doordown();}  //goto door down
 delay(20000);
  }

void doorup(){
digitalWrite(reverse, LOW); //Set motor direction
digitalWrite(forward, HIGH); //Set motor direction
 while (x=1) {
   analogWrite(enable, i);
   int pinState = digitalRead(doorupPin);
   if (pinState == HIGH) {(digitalWrite(forward, LOW)); (doorstate = 0); break;} //stop
   delay(25);
}
}
   
void doordown(){
digitalWrite(reverse, HIGH); //Set motor direction
digitalWrite(forward, LOW);  //Set motor direction 
while (x=1) {
  analogWrite(enable, i);
   int pinState = digitalRead(doordownPin);
   if (pinState == HIGH) {(digitalWrite(reverse, LOW)); (time = 0); (doorstate = 1); break;} //stop
  delay(25);
  }
}

10  Using Arduino / Microcontrollers / ATTINY84 PWM on: November 18, 2012, 04:25:45 pm
Hi

Wonder if anyone can guide me on a problem I have.

Migrating a project from the UNO to a standalone ATTINY84 I've encountered a problem with PWM.

I think Pin 6 and 7 on the ATTINY are the PWM (I've tried both) pins but in my program the motor won't turn on any value other than 255.  Any other values, the motor fails to turn though I can here the motor 'click'.

The PWM signal is sent to Enable 1 on an L293D.

It worked fine on the UNO so I'm thinking a config problem on the smaller chip??

I'm using Arduino as an ISP and have tried both Internal processor speeds on the ATTINY - after burning the bootloader.

Everything works fine apart from being able to control the motor speed!

Appreciate any thoughts please?

11  Using Arduino / Project Guidance / Project with a Motor Sheild (R3) and an Ethernet Shield on: October 27, 2012, 03:44:59 pm
I'm building a project to automatically, based on light levels, open/close a chicken coup door.  All going well so far,  Using an Arduino Uno and a Motor shield I now have a working program.  I wanted to move to the next stage of incorporating an ethernet shield to put put status changes outputs to twitter however there seems to be a clash of pins between the motor shield and the ethernet shield.  Is that correct?  Are there ways around it?
Pages: [1]