Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Remote GPS tracking on: August 03, 2013, 07:28:17 pm
Hello,

I need some suggestions on a new project. I recently had my bicycle stolen (was locked up, b**sterds used bolt cutters) and i am planning on splashing some cash on a new better one. But i was wondering how plausible an Arduino based GPS tracking device would be to make. The GPS part should be relatively easy, but the issue i'm having is the long range communication. I did think about using the cellular network with an Arduino shield, but that would cost for a data plan. So i need some suggestions on communication. It wouldn't be constant, maybe only on demand, or make the GPS output its position once a day which would also help on power consumption.

I did see a youtube video of a guy using walkie talkies using RTTY to send sensor data. This could be a viable solution, although walkie talkies are quite big and would be hard to hide in the frame of the bike, as well as power. It would have to be on all the time. And i know there are already some products on the market that do the functionality i'm looking for but again they use cellular network, and i prefer the DIY aspect.

The communication needs to be over quite some distance, at least 2 miles, but longer the distance the better. Would properly use an Arduino Nano in low power mode to conserve battery.

Any thoughts or suggestions would be greatly appreciated.

Thanks,

Calum.
2  Using Arduino / Installation & Troubleshooting / Re: Arduino wont work on: October 25, 2012, 05:41:56 am
Ye thats what i think it is, I have tried pretty much everything, tried a heat gun to re-flow the solder joints, different computers, different cables and different ATMega328 chips. So im pretty sure is the FTDI chip. I have just bought a new one but went for the Arduino Mega this time. Ill check to see if the ATMega328 chip still works from the busted Arduino by using the Mega to upload sketches to it as i may be able to use it in another project or something.

Thanks.
3  Using Arduino / Installation & Troubleshooting / Arduino wont work on: October 22, 2012, 12:24:03 pm
Hello,

I am having problems with my Arduino Duemilanove. It used to work fine and haven't used in a while but i went to use it the other day and it doesn't work. I connect it to my computer, first of all windows does not detect the Arduino at all, not even as a unknown device. It does not appear in device manager either. And second of all all the surface mount LEDs on the Arduino light up, TX, RX and PWR are all on constantly. I tried removing the ATMega328 chip and the LEDs all still continue to light up. I have even tried a spare ATMega328 chip i had and same problem. I think it may have something to do with the FTDI chip but im not sure. Any light shed on the issue would be much appreciated,

Thanks,

Calum.
4  Using Arduino / Programming Questions / Re: Multiple value serial communication, something is not right...? on: June 24, 2012, 05:12:54 pm
Thanks to those that visited my question, but i think i may have solved the problem.

Because i was reseting the counts to 0 after the stepper motor control. So if i tried sending another command while the stepper motors were still moving, it messed up since the counts were not at 0. Ive rearranged the code now and it seems to work although it sometimes sends the command, then instantly resets to "0 0 0" so the stepper motor moves to the position first set, then back to 0 again which i cant have. But the stepper motors are still very slow but im pretty sure thats due to the code being longer so it takes longer to execute a tick. Again if anyone knows how i can fix this i would be very greatful.

Thanks,

Calum.
5  Using Arduino / Programming Questions / Multiple value serial communication, something is not right...? on: June 24, 2012, 03:42:20 pm
Hello and thanks for visiting my question,

Let me first begin by explaining that im not amazing with arduino and serial is the one thing that gets me every time. It never works how i want it to.

So my project is a Arduino/Processing based CNC. I have built the CNC and it fully works, im controlling the steppers using H-Bridges and the AccelStepper library.

What i need on the arduino side is the ability to send it 3 values, X, Y and Z, and then have the stepper motors step to those positions. At the moment i am just using the Arduino IDE serial screen to send the 3 values. They are send by seperating each value by a space. So the first value would be X, second would be Y and the last would be Z. For example, "200 1000 2500". That is sent on 1 individual line.

Now i kind of have it working, i used various information i found out on the forums to piece this code together. It works but something is not right. Heres the code:

Code:
#include <AccelStepper.h>

int countX = 0, countY = 0, countZ = 0;
int xVal = 0, yVal = 0, zVal = 0;
int ch;
char incomingDataX[5];
char incomingDataY[5];
char incomingDataZ[5];

AccelStepper stepperY(4, 4, 5, 2, 3);
AccelStepper stepperX(4, 6, 7, 8, 9);
AccelStepper stepperZ(4, 12, 13, 10, 11);

void setup(){
 
  stepperX.setMaxSpeed(300);
  stepperX.setAcceleration(100);
  stepperY.setMaxSpeed(300);
  stepperY.setAcceleration(100);
  stepperZ.setMaxSpeed(300);
  stepperZ.setAcceleration(100);
 
  Serial.begin(9600); // Open the serial port with a 9600 baud rate
}

void loop(){
 
  while (Serial.available() && (ch=Serial.read()) >= '0' && (ch <='9')) {
    incomingDataX[countX] = ch;
    countX++;
    incomingDataX[countX] = '\0';
  }
  while (Serial.available() && (ch=Serial.read()) >= '0' && (ch <='9')) {
    incomingDataY[countY] = ch;
    countY++;
    incomingDataY[countY] = '\0';
  }
  while (Serial.available() && (ch=Serial.read()) >= '0' && (ch <='9')) {
    incomingDataZ[countZ] = ch;
    countZ++;
    incomingDataZ[countZ] = '\0';
  }
 
  xVal = atoi(incomingDataX);
  yVal = atoi(incomingDataY);
  zVal = atoi(incomingDataZ);
 
  if (stepperX.distanceToGo() == 0){
    stepperX.moveTo(xVal);
  }
  if (stepperY.distanceToGo() == 0){
    stepperY.moveTo(yVal);
  }
  if (stepperZ.distanceToGo() == 0){
    stepperZ.moveTo(zVal);
  }

  Serial.print(xVal);
  Serial.print(" ");
  Serial.print(yVal);
  Serial.print(" ");
  Serial.println(zVal);
 
  countX = 0;
  countY = 0;
  countZ = 0;
 
  stepperX.run();
  stepperY.run();
  stepperZ.run();
}

Now i have two problems. The first problem is with the AccelStepper library. For somereason the stepper motors dont behave like they did when i was just simply telling it to go to a position line by line. Since i have added all this extra code, the stepper motors dont seem to run as fast and dont run smooth. Is this because the code is taking longer to execute 1 tick? Is there anyway to fix this?

My second problem is with the code, if i send 3 values for example "200 100 3000" sometimes it will work and the stepper motors will move accordingly but sometimes the arduino returns values that are different for example "0 200 100". Like it missed something and shifted the values. Now im not sure why its doing this. And sometimes after i have sent the values, they will all reset to "0 0 0" for no reason.

So its working as i want it to but there are a few bugs that i have no idea how to fix. Any help would be greatly appriciated and i will be happy to post my work for others if they are interested in building a Arduino/Processing based CNC using H-Bridges.

(obviously if i was using easydrivers i would use the amazing GRBL, but i cant afford the huge price for easy drivers so had to go for the cheaper but more complex H-Bridges smiley-razz)

Thanks for reading,

Calum.
6  Using Arduino / Audio / Song Of Storms/Windmill Hut Piezo Tune on: March 26, 2011, 05:28:39 pm
Hey guys.

Was looking around for source codes of Piezo tunes that can be played on the arduino but couldn't find any for the Song Of Storms/Windmill Hut from Legends of Zelda. So i decided to make it myself. Its the best i could get after allot of tweaking but sounds pretty good. Its not the WHOLE full song but does contain the first two verses of the song which are the main two of the song. Feel free to change and edit to maybe extend the song or improve it smiley

------------------------------------------------------------------------------------------------------------------------------------------------------

// Legends of Zelda - Song Of Storms/Windmill Hut
// coded by Calum
// feel free to edit or change the code

// Here are the list of Notes that can be played. You could store these into a libary which is what i did but i decided to leave them in the code so you could see what the notes are callled.

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978


int ledPin = 13; //For visual as well
int speakerPin = 11; //Speaker or Piezo buzzer on pin 11

void setup()   
{
  pinMode(ledPin, OUTPUT); // Setting both pins to outputs
  pinMode(speakerPin, OUTPUT); 
}       

void loop()
{
  song();
}       

void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds)  //code for working out the rate at which each note plays and the frequency.
{
  digitalWrite(ledPin, HIGH);
  int x;     
  long delayAmount = (long)(1000000/frequencyInHertz);
  long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
  for (x=0;x<loopTime;x++)   
  {   
    digitalWrite(speakerPin,HIGH);
    delayMicroseconds(delayAmount);
    digitalWrite(speakerPin,LOW);
    delayMicroseconds(delayAmount);
  }   
  digitalWrite(ledPin, LOW);
  delay(20);
}       

void song()  //here is where all the notes for the song are played.
{       
  beep(speakerPin, NOTE_D5, 100);  //   beep( -PIN OF SPEAKER-, -THE NOTE WANTING TO BE PLAYED-, -DURATION OF THE NOTE IN MILISECONDS- )
  delay(80);
  beep(speakerPin, NOTE_F5, 100);
  delay(80);
  beep(speakerPin, NOTE_D6, 200);
  delay(250);
 
  beep(speakerPin, NOTE_D5, 100);
  delay(80);
  beep(speakerPin, NOTE_F5, 100);
  delay(80);
  beep(speakerPin, NOTE_D6, 200);
  delay(250);
 
  beep(speakerPin, NOTE_E6, 200);
  delay(200);
  beep(speakerPin, NOTE_F6, 100);
  delay(100);
  beep(speakerPin, NOTE_E6, 100);
  delay(80);
  beep(speakerPin, NOTE_F6, 100);
  delay(80);
  beep(speakerPin, NOTE_E6, 100);
  delay(80);
  beep(speakerPin, NOTE_C6, 100);
  delay(80);
  beep(speakerPin, NOTE_A5, 100);
  delay(300);
 
  beep(speakerPin, NOTE_A5, 200);
  delay(100);
  beep(speakerPin, NOTE_D5, 200);
  delay(100);
  beep(speakerPin, NOTE_F5, 100);
  delay(100);
  beep(speakerPin, NOTE_G5, 100);
  delay(100);
  beep(speakerPin, NOTE_A5, 100);
  delay(500);
 
  beep(speakerPin, NOTE_A5, 200);
  delay(100);
  beep(speakerPin, NOTE_D5, 200);
  delay(100);
  beep(speakerPin, NOTE_F5, 100);
  delay(100);
  beep(speakerPin, NOTE_G5, 100);
  delay(100);
  beep(speakerPin, NOTE_E5, 100);
  delay(500);
 
 
 
  beep(speakerPin, NOTE_D5, 100);
  delay(80);
  beep(speakerPin, NOTE_F5, 100);
  delay(80);
  beep(speakerPin, NOTE_D6, 200);
  delay(250);
 
  beep(speakerPin, NOTE_D5, 100);
  delay(80);
  beep(speakerPin, NOTE_F5, 100);
  delay(80);
  beep(speakerPin, NOTE_D6, 200);
  delay(250);
 
  beep(speakerPin, NOTE_E6, 200);
  delay(200);
  beep(speakerPin, NOTE_F6, 100);
  delay(100);
  beep(speakerPin, NOTE_E6, 100);
  delay(80);
  beep(speakerPin, NOTE_F6, 100);
  delay(80);
  beep(speakerPin, NOTE_E6, 100);
  delay(80);
  beep(speakerPin, NOTE_C6, 100);
  delay(80);
  beep(speakerPin, NOTE_A5, 100);
  delay(300);
 
  beep(speakerPin, NOTE_A5, 200);
  delay(100);
  beep(speakerPin, NOTE_D5, 200);
  delay(100);
  beep(speakerPin, NOTE_F5, 100);
  delay(100);
  beep(speakerPin, NOTE_G5, 100);
  delay(100);
  beep(speakerPin, NOTE_A5, 300);
  delay(100);
  beep(speakerPin, NOTE_A5, 200);
  delay(100);
  beep(speakerPin, NOTE_D5, 300);
  delay(2000);
 
}

---------------------------------------------------------------------------------------------------------------------------------------
7  Using Arduino / Installation & Troubleshooting / Arduino Software Glitches. Please Help!! on: March 13, 2011, 10:55:01 am
Hey guys.

I have just ordered my Arduino and should be coming sometime next week. I wanted to familiarize myself with the software so i downloaded the latest Arduino software which is 0022. When i run it and go through the drop down menus i start to see some glitches and the menus go all weird and seem to overlap, then the screen starts to go weird and overlap, like the black debugging box at bottom is a mirror of the coding area so i have just a white screen. I have looked into the problem online and i have seen that others have had similar problems. I tried a fix that someone said worked which is to download JRE 32bit and replace that with the java that comes with Arduino, but still no luck. I removed the java folder from Arduino, the program still ran but still got the glitches. I don't know what to do now. Here is what it looks like:



See its all overlapped and glitched out.
I'm running Windows 7 Home Premium 64bit, I have the latest Java software. If anyone knows how to fix this i would be very grateful.

Thanks.

-Calum
Pages: [1]