Show Posts
Pages: [1] 2
1  Community / Exhibition / Gallery / Re: Motorless stir plate on: August 09, 2013, 12:35:37 pm
Very nice work! But it really isn't "motorless" , you just created a motor in the apparatus. 

Fair enough.  I just called it that to differentiate it from the usual approach used by homebrewers: gluing a salvaged hard drive magnet to a salvaged computer case fan.

Does the propeller have a shaft or is it held in place by the magnetic field?

No shaft, just the field.
2  Community / Exhibition / Gallery / Motorless stir plate on: July 25, 2013, 07:23:58 pm
I'm posting this to respond to a request for the code used to create the circuit in this video




Here you go, arduinoversusevil.  I never really finished the code, or took the hardware further than the video. 
Kind of like solving a Rubik's cube:  once I figured out how to make it work, I got bored with it and shelved it. 

Code:
/*
Stirplate - controls an array of four electromagnets to spin a teflon
 encapsulated stirbar in a flask, such as used by homebrewers to culture yeast.
 
 This is based on the basic "FADE" sketch.  Two pairs of magnets create an x and y axis. 
 The pulling force of the magnet swings back and forth from the x to the y axis,
 the H-Bridge is used to reverse the polarity of each axis when it is at 0 force.
 
 
 This is written to run on an Atmel ATtiny84.  I would suspect it would run equally well
 on an ATtiny85, but I am not familiar with the process to designate the RESET pin
 to work as an I/O, or the process to refuse should I want to reprogram the chip afterwards.
 
 The information in this thread: http://arduino.cc/forum/index.php/topic,87517.0.html
 may be useful for anyone who chooses to try this on at ATtiny85.  If you do, please let
 me know how it comes out.  chuck.falls@gmail.com
 
 
 
 Software:
 You will need to gather and install all of the support files and libraries as detailed on this page:  http://hlt.media.mit.edu/?p=1695
 
 Hardware:
 (4) electromagnets (Mine are model: ZYE1-P20/15)
 (1) ATmel ATtiny84
 (1) SN754410
 (1) LM7805 (and filter capacitors of your choosing)
 (1) Switched potentiometer, or a switch and a potentiomter.
 (3) 10uf decoupling capacitors - VCC on the ATtiny84 (pin 1), VCC1 and VCC2 on the SN754410 (pins 8 & 16)
 
 
 */

int xaxis = 6;        //connect to the pin 1 on the SN754410 
int yaxis = 5;        //connect to the pin 9 on the SN754410 
int logicA1 = 8;        //connect to the pin 7 on the SN754410 
int logicA2 = 7;        //connect to the pin 2 on the SN754410 
int logicB1 = 3;        //connect to the pin 10 on the SN754410 
int logicB2 = 4;        //connect to the pin 15 on the SN754410 


int potPin = 0;
int force = 0;   
int fadeAmount = 51;    //3, 5, 15, 17, 51, & 85 should all be acceptable
int delaytime = 1000;
int state = 0;

//
void setup()  {
  pinMode(xaxis, OUTPUT);
  pinMode(yaxis, OUTPUT);
  pinMode(logicA1, OUTPUT);
  pinMode(logicA2, OUTPUT); 
  pinMode(logicB1, OUTPUT); 
  pinMode(logicB2, OUTPUT);
  pinMode(potPin, INPUT);



  /*this section just turns the magnets on and holds a position for 5 seconds.  This is necessary as there is no magnet upon which to
  center the stirbar until after the "motor" is turned on and is already spinning.*/
  digitalWrite(logicA1,HIGH);
  digitalWrite(logicA2,LOW);
  digitalWrite(logicB1,HIGH);
  digitalWrite(logicB2,LOW);
  digitalWrite(xaxis, HIGH);   
  digitalWrite(yaxis, HIGH);
  delay(500);



}


void loop()  {

  analogWrite(xaxis, force);   
  analogWrite(yaxis, 255-force);   

if (millis()<(20*1000)) delay((20000/millis())+14);
else delay(14);

  // change the force for next time through the loop:
  force = force + fadeAmount;


  if (force == 0 || force == 255)   // if the magnet is aligned withe the x-axis or y-axis
  {
    switchState(); //four states direct the polarity of the magnets
    fadeAmount = -fadeAmount ; //swings the "on" magnet from the y-axis to the x-axis, and then back.
  }




void switchState()
{
  if (state==3) state=0;
  else state+=1;

  if (state==0)
  {
    digitalWrite(logicA1,HIGH);
    digitalWrite(logicA2,LOW);
  }
  if (state==1)
  {
    digitalWrite(logicB1,LOW);
    digitalWrite(logicB2,HIGH);
  }

  if (state==2)
  {

    digitalWrite(logicA1,LOW);
    digitalWrite(logicA2,HIGH);

  }
  if (state==3)
  {
    digitalWrite(logicB1,HIGH);
    digitalWrite(logicB2,LOW);
  }
}










3  Products / Arduino Due / Re: PID library on: July 25, 2013, 07:11:59 pm
I'd given up on anyone replying to this.  Thanks, both of you.
4  Products / Arduino Due / PID library on: June 12, 2013, 10:51:52 pm
Has anyone successfully (or unsuccessfully) run the PID library on the DUE?

5  Using Arduino / General Electronics / Re: PCB Trace width question. on: June 12, 2013, 12:19:37 am
What's the distance here? ...People talk about maybe 5-10 feet, and it sounds like your distances are much greater.

No, far less.  The whole contraption is only 5 feet long.  The application is a three vessel brewery, like these:
https://www.google.com/search?q=brutus+10&um=1&ie=UTF-8&hl=en&tbm=isch&source=og&sa=N&tab=wi&ei=O_u3UaOcK4TU9gTA1IGAAw&biw=2560&bih=1509&sei=vfu3Uf-3PIXy9gSas4G4Cg

These are commonly built with a large control panel built on a huge NEMA enclosure.  There is usually a 220 feed, controlled by PIDs and relays, and then numerous 220 lines go to various parts of the brewery.  See http://www.theelectricbrewery.com/gallery to get an idea of what I mean.
Here's the scene I want to avoid: http://www.beerobsession.com/wp-content/uploads/2011/04/IMG_0695_rdy.jpg

My intent is to minimize the 220 wiring by having a din rail run basically the length of the brewery, and having the SSR's as close to the elements, valves and pumps as possible.  I'd have an I2C slave board for each component, so I'd really only need four wires for all of the controls.  These phase angle controllers are going to be three of those slaves.

So, I guess have options:

1.  draw an I2C slave for the pumps with the microcontroller, the 220 relays, all of it, and mount it right on the pump bracket.
2.  draw a board for just the 220 parts - the mechanical relay, the SSRS, and the H11A1, and send the zero-crossing signal back to an I2C slave on the DIN rail (~9 inches away from the AC pump motors).
3.  draw a board for just the 220 parts - the mechanical relay, the SSRS, and the H11A1, and send the zero-crossing signal back to the control panel itself (2-5 feet from the pump motors).
6  Using Arduino / General Electronics / Re: PCB Trace width question. on: June 11, 2013, 07:59:55 pm
Found this elsewhere:

"The thickness of copper clad on a circuit board is usually given in ounces (oz). It is the weight of copper on one square foot of board. One ounce copper is 1.378mils (~35um) thick."

Thanks for looking that up!

IOW, when using 220 VAC and inductive loads, there are many factors that need to be taken
into account, and industrial controllers for these sort of apps tend to have all sorts of EMI,
ESD, and other suppression and noise filtering circuitry. Basically, this is a nasty environment,
and little 5V controllers can have reliability problems. I'd suggest you do some background
research on this whole topic.

Thanks for the response, and the advice!

So, a wiser choice may be to put the H11AA1, the SSRs, and the mechanical relay in a little enclosure next to each pump, and send the zero cross pulse back to a control board that's distant from the 220 portion altogether?
7  Using Arduino / General Electronics / Re: PCB Trace width question. on: June 09, 2013, 04:26:16 pm
so although trace width is a flexible choice you want to try to be conservative - but you can increase that 1C to 2 or 3 I think.

Thanks a lot for your reply!  I thought that 1 was the most conservative option.  A 2 degree tolerance calls for 81.71 mils; 3 degrees calls for 63.88.

Are you saying that I would benefit from the narrower trace and should use it because of expansion issues? Or just that I probably could get away with it if I wanted to, because a 2-3 degree temp rise is trivial?
8  Using Arduino / General Electronics / PCB Trace width question. on: June 09, 2013, 03:39:13 pm
I want to use the example found at http://playground.arduino.cc/Code/ACPhaseControl to control the speed of some pumps.  The pumps, located at http://chuggerpumps.com/product.php?prodid=237, are 220v, 290 watt, thus pulling around 1.3 amps correct?

The board house I've been using is iTead.   Outside conductive layers are 35um. I'm using this trace width calculator: http://www.desmith.net/NMdS/Electronics/TraceWidth.html

I put in the following number:
Amps: 2
Rise: 1 degree
Thickness: 35um
Ambient: 40 (it gets hot out in the garage/driveway!)
Trace length:  20mm (I put the SSRs and H11AA1 right at the edge of the board, actually less than 20mm)

The output is that I need 125mil of trace width, with >71mil of space. 

I have no reason to doubt the correctness of that number, but I want to put up to you guys to see if that number seems feasible.  Is there any reason I can't I put a 70 mil trace on each side?
9  Using Arduino / Networking, Protocols, and Devices / Re: Sending int over I2C - UNO master, ATtiny85 slabe on: May 20, 2013, 09:29:04 pm
And, in contrast - this works perfectly if I use a Nano as a slave instead of a tiny. 

Code:
#include "Wire.h"                 
#define I2C_SLAVE_ADDR  0x26           
#define Sensor_PIN  3
int pressure;

void setup(){
  pinMode(Sensor_PIN,INPUT);
  Wire.begin(I2C_SLAVE_ADDR);     
  Wire.onRequest(requestEvent);
}

void loop()
{
}


void requestEvent()
{
  pressure=analogRead(Sensor_PIN);
  byte plow=lowByte(pressure);
  byte phi=highByte(pressure);
  byte data[]={plow, phi};
  Wire.write(data, 2);
  }
10  Using Arduino / Networking, Protocols, and Devices / Re: Sending int over I2C - UNO master, ATtiny85 slabe on: May 20, 2013, 08:49:20 pm

its here - http://playground.arduino.cc/Main/WireLibraryDetailedReference -

check requestFrom(address, count);

Thanks for pointing me in that direction.  Between that, and plagerizing other code here from the forum (http://forum.arduino.cc/index.php/topic,160680.0.html), I now have a pair of sketches that work, at least.  Despite it's function, I'm not fond of this code on the slave.

First, here's the master code so you can see it.
Code:
#include "Wire.h";
int ATtinyAddress=0x26;
unsigned long marktime;

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}


void loop(){
  if (millis()>marktime)
  {
    byte hb;
    byte lb;
    Wire.requestFrom(ATtinyAddress,2);
    if (Wire.available())
    {
      lb=Wire.read();
      hb=Wire.read();
    }
    int pressure=word(hb,lb);
    Serial.println (pressure);
    marktime+=1000;
  }
}

Here's the slave code that works.

Code:
#include "TinyWireS.h"                  
#define I2C_SLAVE_ADDR  0x26            
#define Sensor_PIN  3
boolean firstbyte = true;

void setup(){
  pinMode(Sensor_PIN,INPUT);
  TinyWireS.begin(I2C_SLAVE_ADDR);      
  TinyWireS.onRequest(requestEvent);
}

void loop(){
}


void requestEvent()
{
  int pressure=analogRead(Sensor_PIN);
  byte plow;
  byte phi;

  if(firstbyte == true)
  {     // on the first byte we do the math
    plow=lowByte(pressure);
    firstbyte = false;      //so next time though we send the next byte    
    TinyWireS.send(plow);
  }
  else
  {
    phi=highByte(pressure);
    TinyWireS.send(phi);
    firstbyte = true;
  }
}

I don't understand why this code doesn't work.  What purpose does the boolean firstbyte serve in the above sketch?
Code:
void requestEvent()
{
  int pressure=analogRead(Sensor_PIN);
  byte plow;
  byte phi;
  plow=lowByte(pressure);
  phi=highByte(pressure);
  TinyWireS.send(plow);
  TinyWireS.send(phi);
}
11  Using Arduino / Networking, Protocols, and Devices / Sending int over I2C - UNO master, ATtiny85 slabe on: May 19, 2013, 10:56:58 pm
I'm trying to use an ATtiny85 to read a MPX5010DP Freescale Pressure Sensor, then send the reading back to an UNO via I2C.  It's just an analog read of the sensor.
I've looked at a number of examples, and this is a far as I've gotten with it.  I can read the pin, map the 0-1023 reading down to 0-255 and send it as a byte using the below pair of sketches.

On the UNO:

Code:
#include "Wire.h";
int selection=0;
int ATtinyAddress=0x26;
unsigned long marktime;

void setup(){
  Wire.begin();
  Serial.begin(9600);
}
void loop(){
  if (millis()>marktime)
  {
  Wire.requestFrom(ATtinyAddress,1);
  while(Wire.available())
  {
    byte v = Wire.read();
    Serial.println(v);
  }
  marktime+=1000;
  }
}


on the ATtiny85

Code:
#include "TinyWireS.h"                 
#define I2C_SLAVE_ADDR  0x26           
#define Sensor_PIN  3

void setup(){
  pinMode(Sensor_PIN,INPUT);
  TinyWireS.begin(I2C_SLAVE_ADDR);     
  TinyWireS.onRequest(requestEvent);
}

void loop(){
}

void requestEvent()
{
  int pressure=analogRead(Sensor_PIN);
  byte pbyte=map(pressure,0,1023,0,255);
  TinyWireS.send(pbyte);
}

I'd like the full resolution of the Tiny, though.  I know I can use lowByte & highByte to get a pair of bytes, and I know I can word() the two back together once I have them on the UNO.
I'm lost at the part of requesting and receiving two bytes, instead of one, and assigning them usable values on the UNO side.
12  Development / Other Software Development / Help w/ Mouse.click(); when using absolute mode on: January 06, 2013, 12:53:43 am
I'm starting a new thread, as the other thread seems to have died out.

I followed the steps here:  http://arduino.cc/forum/index.php/topic,94140.0.html

I am able to get the mouse cursor to move to a specific location on the screen, as expected.  I am unable to get the Mouse.click() command to click, though.  Has anyone else used this modified HID.cpp file successfully?
13  Development / Other Software Development / Re: USB Absolute Mouse Mode on: December 17, 2012, 10:04:09 pm
I was able to get the cursor to stop moving to 0,0 upon Mouse.click();
In the HIP.CPP, I found

Code:
void Mouse_::click(uint8_t b)
{
_buttons = b;
  move(0,0,0);
_buttons = 0;
  move(0,0,0);
}
and changed it to
Code:
void Mouse_::click(uint8_t b)
{
_buttons = b;
// move(0,0,0);
_buttons = 0;
// move(0,0,0);
}

However, I am still not getting a click in absolute mode.  Any ideas?
14  Development / Other Software Development / Re: USB Absolute Mouse Mode on: December 16, 2012, 07:09:43 pm
I was able to use this example to successfully get the mouse to move to a specific location.  It works exactly as expected, until  I follow this with

Mouse.click();

The mouse moves to the extreme upper left hand corner of the screen before clicking instead of remaining where I put it.
Am I overlooking something?
15  Using Arduino / Programming Questions / Re: Can anyone help me trim this down? (8,168 of 8,192 used) on: October 17, 2012, 11:50:57 pm
Very impressive!

Thanks to you guys for your tips.  Just using the skip brought me down to 7740.

Eliminating the library altogether brought it down to 7474, but introduces some flaky behavior.  The sensor will stay, mostly, at 79.91 (accurate), but will jump to an absurd number very briefly then immediately back to 79.91.  I'm guessing that I need to slow my sample rate of the sensor down to allow it time to reset?

Pages: [1] 2