Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: Controlling Resistance Heaters on: April 23, 2012, 06:52:03 pm
I think you're going to have to buy something for this one man.

At my workplace, we use a lot of resistance heater "hot plates", called black bodies.

Anyways, i've seen two different controllers around to control the temp. One is made by this company called Arroyo, which looks REALLY nice and REALLY expensive. The other one is some rig that somebody made themselves, and judging from the amount of work it looks like they put into it, I don't think you're going to want to mess with trying to make one yourself.

Of course, the ones at work have nice little LCD outputs, rotary encoders, and RS232 ports for control, so maybe if you obviate those parts of the setup, making one might be more manageable.
2  Using Arduino / General Electronics / Hard drive + Honda CRV = overloaded 12v line? on: April 23, 2012, 06:45:20 pm
EDIT: I'm a moron for only testing the 12v line on my car without the engine running, and thus assuming it was regulated.

TL;DR : Put a 3.5" hdd in my car, powered by + - 12v from cigarette lighter lines. Blew two 10A fuses in a row on my Radio's line, but the cigarette lighter was still receiving power each time. I turned the HDD off and put a 7.5 A fuse in, and everything was fine. Why is this setup causing me to blow fuses on a totally different line?

Yesterday I embedded a 3.5" hard drive (in a Rosewill enclosure) into the glovebox on my 2001 CRV, so I could keep my music and video library in my car. The hard drive receives power from the 12v cigarette lighter jack on the center console (I just spliced into the lines). I made a little USB Y cable, that has one female USB A port for the drive to plug into, a male USB Micro B jack that plugs into my Android phone, and a male USB A jack that is ONLY connected to the 5v + and - lines of the cable, which plugs into USB car charger that I have plugged into my cigarette lighter.

The cigarette lighter is cable of supplying 10 Amps. The entire setup only draws 2 A for the drive, and the USB charger is only capable of supplying 750 mA, so all together the setup draws 2.75 A MAX, well under the jacks capabilities.

The whole setup worked fine, other than the fact that it takes a little while for the phone to recognize the drive, which can get a little annoying if you're starting and killing your engine a lot.

Or at least it WAS working fine. I decided to take a little detour down a cliff road (think canyon road) on my way to my destination (for locals, it was Blowhole/Sandys Makapu'u road), and was driving somewhat spiritedly in my little grandma mobile. Everything was fine, until I hear a pretty loud POP and see a flash of light come from my interior fusebox, as my deck went black. "DAMN, blew a fuse".

HOWEVER, my USB charger was still receiving power (indicator LED on its face was lit up), and my phone still played music, leading me to believe the hard drive was still being powered too. From this, I deduced that the Radio was on its own fuse, and that my setup had nothing to do with the fuse blowing. I assumed that it was just a freak occurrence.

So I arrive at my destination, change the fuse, and embark back home. I took the cliff road again, only this time I WASN'T driving "spiritedly". Fuse blows again. At this point, I start to wonder if maybe my setup really did have something to do with the fuse going, since I had blown two fuses within maybe like 20 minutes of my car being on.

I pull into a gas station and swap the fuse, but this time I was all out of spare 10 A fuses. I turned the harddrive to OFF and popped in a 7.5 A fuse, and made it home without blowing another one.

So, at this point, i'm somewhat torn. I'm led to believe that my little jerry rig HDD setup has something to do with this fuse blowing problem, since I stopped blowing fuses once I turned the drive off.

On the other hand though, I have a feeling the hard drive setup has nothing to do with it, because the hard drive only draws 2 A of power, which means I would have blown that 7.5 A fuse by now because there'd still be over 8 A of current left over. The only explanation for this, is that the USB port of the hard drive draws a lot of power, so turning off the drive alleviates 2 A + whatever the USB port draws.

But even still, why on earth would both the drive and the phone still be working after the fuse goes out?

Anybody have any ideas?
3  Using Arduino / Programming Questions / Re: Arduino reading serial data too quickly? on: March 15, 2012, 01:46:41 am
After reading through the Serial page on your site, I started rewriting the entire program (for the third time smiley-razz). It's turning out far more encapsulated this time around, and i'm not encountering nearly a fraction of the problems I had the first two times. Thanks!
4  Using Arduino / Programming Questions / Arduino reading serial data too quickly? on: March 14, 2012, 11:32:41 pm
Hey guys, i've got a pretty simple problem here. What I have is a program which reads commands from the serial port, then moves a stepper motor based on what it receives.

It seems to work pretty well, but if you'll notice, i've got a short 10ms delay at the beginning of my code (marked with two question marks). If I remove this delay, the code will work fine in the arduino serial monitor, but if I try to use br@y's terminal to send commands, I wind up with all sorts of random symbols in between bytes, I assume because the arduino is reading bytes faster than the terminal can supply them.

The delay seems to work well enough, but it kinda seems like a poor way of doing things, as it's currently set to an arbitrary value.

I guess my question is, what am I doing incorrectly in my code to incite this discrepancy?

Code:
/**
**/

#include <Stepper.h>

const String errorMsg = "invalid command";

const int rev = 200; // #of steps in one revolution of the motor
const int deviceNum = 1; //this is the number of the arduino in mark's prog
const int homeSwitch = 8; //pin # for home position limit switch
const int motorPin[] = {13, 12, 11, 10};
const float mmPerStep = .0508;

//commands
const String stopCmd = "ST";
const String posAbsCmd = "PA";
const String homeCmd = "MO";
const String currentPosCmd = "CP";

Stepper stepper(rev, motorPin[0], motorPin[1], motorPin[2], motorPin[3]);

//storage variables
char inByte;
String inString;
int head;
String cmd;
String foot;
int strPointer;
boolean isGood;
float cmdVal;

int currentPos;

void setup(){
  Serial.begin(57600);
  pinMode(homeSwitch, OUTPUT);
  stepper.setSpeed(60); //speed of the motor in RPM
//  establishContact();
}

void loop(){
  
  if(Serial.available() > 0){
    
    while(Serial.peek() != 13 && Serial.peek() != 10){      
      inByte = Serial.read(); //recieve bytes
      
//      Serial.print("inByte ");
//      Serial.println(inByte);
      
      inString += inByte; //arrange into a string
      delay(10); //???
    }
    
//    Serial.print("inString ");
//    Serial.println(inString);
    
    if((inString.charAt(0) >= 48) && (inString.charAt(0) <= 57)){ //if the first character is a number    
      
      for(int i = 0; (inString.charAt(i) >= 48) && (inString.charAt(i) <= 57); i++){ //until a non 0-9 character is encountered
        head = head * 10 + (inString.charAt(i) - '0'); //add the character to the head var
        strPointer = i;
      }
      
      if(head == deviceNum){ //if they're talking to us
        
        strPointer++;
        
        for(int i = strPointer; i < inString.length(); i++){
          if(!((inString.charAt(i) >= 48) && (inString.charAt(i) <= 57) || (inString.charAt(i) == 46))){
            cmd += inString.charAt(i);
          } else {
            break;
          }
            strPointer = i;
        }
        
//        Serial.print("cmd ");
//        Serial.println(cmd);
        
        if(cmd == "PA"){
          //Position Absolute
          
          isGood = true;
          
          for(int i = strPointer + 1; i < inString.length(); i++){
            if(!((inString.charAt(i) >= 48) && (inString.charAt(i) <= 57) || (inString.charAt(i) == 46))){
              isGood = false;
            }
          }
          
          if(isGood){
            
            strPointer++;
            
            inString = inString.substring(strPointer);
            char cArray[inString.length() + 1];
            inString.toCharArray(cArray, sizeof(cArray));
            cmdVal = atof(cArray);
            
            if(currentPos > 0){
              currentPos = posAbsolute(mmToSteps(cmdVal), currentPos);
            } else {
              Serial.println(errorMsg);
            }
            
          } else {
            Serial.println(errorMsg);
          }
          
        } else if(cmd == "MO"){
          //return to home position
          currentPos = returnHome();
        } else if(cmd == "ST"){
          //stop
          for(int i = 0; i < 4; i++){
            digitalWrite(motorPin[i], LOW);
          }
        } else if(cmd == "ABS?"){
          //querry position
          Serial.println(stepsToMm(currentPos));
        } else {
          Serial.println(errorMsg);
        }        
      }
      
    } else { //if first char is NOT a number
    
      Serial.println(errorMsg);
      
    }
      

//    Serial.print("peek foot ");
//    Serial.println(Serial.peek());
    Serial.read(); //remove \r from buffer
    Serial.read(); //remove \n from buffer
  }
  //reset all values in preparation for next input
  strPointer = 0;
  inString = "";
  head = 0;
  cmd = "";
}

static int returnHome(){
  while(digitalRead(homeSwitch) == LOW){
    stepper.step(1);
  }
  return 1;
}

static int posAbsolute(int toPos, int curPos){
  int steps = toPos - curPos; //distance from curPos to toPos
  int stepsTaken; //pretty straight forward
  
  if(steps > 0){
    for(stepsTaken = 0; stepsTaken < steps && digitalRead(homeSwitch) == LOW; stepsTaken++){
      stepper.step(1);
//      Serial.println(stepsTaken, DEC);
    }
  } else if(steps < 0){
    for(stepsTaken = 0; stepsTaken > steps && digitalRead(homeSwitch) == LOW; stepsTaken--){
      stepper.step(-1);
//      Serial.println(stepsTaken, DEC);
    }
  }
  return curPos + stepsTaken;
}

static int mmToSteps(float mm){
  int steps = (int)(mm / mmPerStep);
  
  return steps;
}

static int stepsToMm(int steps){
  int mm = steps * mmPerStep;
  
  return mm;
}

void establishContact() {
  while (Serial.available() <= 0) {
    Serial.println("0,0,0");   // send an initial string
    delay(300);
  }
}
  
  
5  Using Arduino / Programming Questions / Re: Serial communication test file producing bizarre results on: March 14, 2012, 04:06:40 am
Alright, well I started from scratch after determining that pretty much everything about the program was incorrect. Expect to hear from me soon though, when I inevitably **** everything up again.

Moderator edit: Language.
6  Using Arduino / Programming Questions / Re: Serial communication test file producing bizarre results on: March 14, 2012, 02:58:02 am
The only problem with that, is that my program is using carriage returns to mark the beginning of a command, as opposed to the end of one

EDIT: Although this is probably the wrong way of going about things...
7  Using Arduino / Programming Questions / Serial communication test file producing bizarre results on: March 14, 2012, 02:40:59 am
What's up guys. Basically, I have a stepper motor run by an arduino, which takes commands from another program via serial.

The commands are separated by a cariage return line feed. Of course, I have no idea how to emulate these characters in the arduino serial monitor, so I wound up creating a test file and passing it to the arduino via br@y's terminal.

my test file looks like this:

Code:
1MO

So basically, enter (Carriage Return), followed by 1(the number of the device), then M0 (the actual command).

So, my first problem is, how in god's name am I supposed to pass ASCII 10 (new line) to the arduino? Trying use ALT+010 or cntrl+J work fine in br@y's terminal, but in notepad it just nets me another carriage return. If I could figure out a way to pass entire strings via br@y's term, I guess that'd suffice, but that doesn't seem possible.

My second problem, and what's pissing me off the most, is what is with these bizarre characters that follow the carriage return??? Using the test file, instead of producing the expected ASCII 13 (\r) followed by ASCII 49 (1), etc etc, the arduino winds up reading ASCII 13, followed by ASCII -1. What's even weirder is that, if I change the program to expect ASCII 13 followed by ASCII -1 (as opposed to ASCII 13 ASCII 10), the next digit to follow ISN'T ASCII 49, but instead some random ass character. Sometimes it's another -1, other times it's this thing (ΓΏ), sometimes it's a space (not ASCII 32, but literally a blank character) and sometimes it'll be ASCII 10!!!

I figure there's some fundamental nuance to using a carriage return, or maybe even serial communication that i'm unaware of, as the random characters after the carriage return leads me to believe i'm not buffering them correctly, but atm i'm totally stumped.

Help is greatly appreciated!

Here's what my code currently looks like:

Code:
#include <Stepper.h>

const int rev = 200; // #of steps in one revolution of the motor
const char deviceNum = '1'; //this is the number of the arduino in mark's prog
const int homeSwitch = 8; //pin # for home position limit switch

//commands
const char stopCmd = 'ST';
const char posAbsCmd = 'PA';
const char homeCmd = 'MO';
const char currentPosCmd = 'CP';

Stepper stepper(rev, 13,12,11,10);

//storage variables
char inByte; //buffer for incoming bytes

char command;
char commandTest;

int currentPos; //motor's current position in number of pulses from 0
int toPos; //desired position in num of pulses from 0
float floatByte;



void setup(){
  Serial.begin(57600);
  pinMode(homeSwitch, OUTPUT);
  stepper.setSpeed(60); //speed of the motor in RPM
//  currentPos = returnHome(); //calibrate to home position
}

void loop(){
  
  if(Serial.available() > 0){
    inByte = Serial.read();
    
    Serial.print("byte 1 = ");
    Serial.println(inByte, DEC);    
    
    if(inByte == 13){
      inByte = Serial.read();
    
      Serial.print("byte 2 = ");
      Serial.println(inByte, DEC);
      if(inByte == -1){
        inByte = Serial.read();
        
        Serial.print("byte 3 = ");
        Serial.println(inByte);
        if(inByte == deviceNum){ //if they're talking to us...
          //what are they saying
          inByte = Serial.read();
          
          Serial.print("byte 4 = ");
          Serial.println(inByte, DEC);  
          
          command += inByte;
          
          inByte = Serial.read();
          Serial.print("byte 5 = ");
          Serial.println(inByte, DEC);  
          
          command += inByte;
          Serial.print("command byte = ");
          Serial.println(command);
          
          if(command == posAbsCmd){ //Position Absolute
            commandTest = '0';
            for(int i = 0; inByte > 0; i++){ //change >0 to \r\n
              inByte = Serial.read() - '0';
              commandTest += inByte;
            }
            
            Serial.print("num = ");
            Serial.println(commandTest);

          } else if(command == stopCmd){ //stop command
            //stop
            digitalWrite(13, LOW);
            digitalWrite(12, LOW);
            digitalWrite(11, LOW);
            digitalWrite(10, LOW);
          } else if(command == homeCmd){ //home command
            //return to position 0
            currentPos = returnHome();
            Serial.print("current position = ");
            Serial.println(currentPos, DEC);
          } else if(command == currentPosCmd){ //current position query
            Serial.println(currentPos, DEC);
          }
        }
      }
    }
  }
  
  //reset everything
  
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  digitalWrite(10, LOW);
}

//positioning function
static int posAbsolute(int toPos, int curPos){
  int steps = toPos - curPos; //distance from curPos to toPos
  int stepsTaken; //pretty straight forward
  
  if(steps > 0){
    for(stepsTaken = 0; stepsTaken < steps && digitalRead(homeSwitch) == LOW; stepsTaken++){
      stepper.step(1);
      Serial.println(stepsTaken, DEC);
    }
  } else if(steps < 0){
    for(stepsTaken = 0; stepsTaken > steps && digitalRead(homeSwitch) == LOW; stepsTaken--){
      stepper.step(-1);
      Serial.println(stepsTaken, DEC);
    }
  }
  return curPos + stepsTaken;
}

//homing function
static int returnHome(){
  while(digitalRead(homeSwitch) == LOW){
    stepper.step(1);
  }
  return 0;
}
8  Using Arduino / Programming Questions / including classes from wherevers on: September 05, 2011, 11:45:10 pm
Let's say I want to use a class I wrote in my code, but I don't want to actually save it to the arduino libraries folder. How might I go about doing this?

I've got a stupid simple "motor" and "sensor" class I wrote, just to make my code read a little cleaner, so it seems a little much to actually save it as a true "library".

EDIT: Dammit, I meant to post this in the Programming section
9  Using Arduino / General Electronics / Re: reusing shattered solar panel on: September 04, 2011, 03:17:04 am
Quote
The tempered glass covering the panel is actually totally shattered, so I don't think it'd be too feasible to chip it all off and put a replacement without damaging the cells in the process.

Why is any chipping required?  There typically is no attachment between the glass and the PV cells.  I would think you should be able to disassemble the frame and dump the glass into the recycle bin.  And then replace it with a piece of similar dimensions.


The frame is actually just held together with screws and caulking, so this is definitely a possibility.  I'm just not too sure how i'd go about sealing the glass once it's in place. I know the back of the frame is sealed with nothing more than silicon caulk, but i've never gone so far as to see how the glass is bonded to the frame (although I suppose it's about time).

Oh, and it's actually Downtown Honolulu smiley-grin
10  Using Arduino / General Electronics / Re: electric fence batteries - possible use ? on: September 03, 2011, 04:08:17 pm
10 days = 240 hours

200 mA * 240 hours = 48A

I think the batteries should be fine.
11  Using Arduino / General Electronics / Re: reusing shattered solar panel on: September 03, 2011, 03:59:32 pm
The tempered glass covering the panel is actually totally shattered, so I don't think it'd be too feasible to chip it all off and put a replacement without damaging the cells in the process. The cells themselves seem to be totally fine though, as far as I can tell. None look to be cracked, and all the conductors are in good shape.

I'm thinking now that it might be best to just coat the thing with some sort of 100% light pass through resin or epoxy. Maybe whatever they use to fix auto windshields. God knows this might end up costing more than the panel itself though!

I just linked a picture in my original post to show the damage.
12  Using Arduino / General Electronics / reusing shattered solar panel on: September 03, 2011, 05:23:24 am
So I grabbed a shattered solar panel from work today, with the intent of somehow reusing it. I was originally thinking of just breaking away all the shattered glass to reuse the individual solar cells, but I can't imagine it'd be easy to do without damaging either myself, or the cells.

The other obvious idea is to just reuse the panel in its current state, but i'd have to somehow resurface it in order to prevent moisture from getting in.

Tomorrow i'll post up the actual panel model and ratings (it's sitting in my car atm and will be hard to get to in the dark), and then hit it with a multimeter to see what sort of voltage the thing is still putting out. I know the fully sunlit rating is about 37v, so i'm sure that even in its shattered state it'll be putting out some useful amount of energy.

I guess i'm basically asking, is reusing the individual cells as simple as just removing them and soldering leads to the little conductors which connect them in series? And does anybody know what sort of epoxy or resin would work well for resurfacing the glass, or perhaps just have tips for doing it? I have access to at least 2 more at work, so I can experiment with taking one apart and just reusing another.

EDIT: Pictures and stuff

The shattered panel

http://i218.photobucket.com/albums/cc201/sinkoman_iii/2011-09-03_10-31-55_113.jpg
   
Test conditions

http://i218.photobucket.com/albums/cc201/sinkoman_iii/2011-09-03_10-32-12_271.jpg

Panel is a Trina 230 watt, with a rated open circuit voltage of 37v. In the test conditions above, I was getting between 34-32v (depending on cloud cover), so it still seems to be pretty useful.

I didn't measure amperage because I wasn't too sure of how to go about doing that. Just shorting the two leads seemed like a bad idea...
 
13  Using Arduino / General Electronics / Re: H-bridge not sourcing enough current on: August 20, 2011, 03:28:22 pm
I'm thinking maybe I do just need to go with MOSFETS, because i've already tried connecting Q1 to Q3 as a Sziklai pair, thinking the voltage drop was the problem, and I still had the exact same problem. I was hoping to avoid using MOSFETS, as p-channel ones are impossible to find locally, and shipping costs here are pretty ridiculous. Oh well :/


14  Using Arduino / General Electronics / Re: H-bridge not sourcing enough current on: August 20, 2011, 05:25:34 am
I already tried adjusting the power supply to offset Vout with the motor connected (but unloaded), and the current draw when stalled is still topping out at 1.8-1.9 A :/
15  Using Arduino / General Electronics / Re: H-bridge not sourcing enough current on: August 20, 2011, 05:06:52 am
Hadn't bothered to measure load voltage till now. Drops about .25 V with the motor+gearbox+wheel connected.

EDIT: When stalled, the drop is 1.7 - 1.75 V
Pages: [1] 2