Disc1 Arduino Doser

Brilliant. :) I'll fix it tomorrow.

With just the MOSFETs it makes it low enough to turn them off, so I guess I never though to add something.

Thanks!
 
I have been running my Dosers units using I2C on the Ardunio to a PCF8574 and getting control 8 of them turning ON and OFF based on my requirement...
 
How goes it? Thinking about using my spare prototype hydra board for dosing instead of the light timers I'm using now.

I'll check out the eagle files for you tonight. Have you see iteadstudio.com for pc boards? They were the cheapest we could find, but you get 10 boards and it takes 2-3 weeks.
 
Disc1, when your pumps weren't turning off while using the NPN transistors, would they have less power? Like partial power?

And did connecting a pulldown resistor to between the NPN and uC IO pin fix the problem?
 
It's been running for six weeks without a hitch so far. The container volume is keeping track with the actual volume in the container and it has taken about the right amount of time to empty the container, so I assume things are running well.

nrbelk,

When I had the issue with the transistors, the pumps stayed on full speed. I put a pulldown from the base to ground, and that got them to shut off. But then I ended up pulling the NPN's out all together and just driving the MOSFET directly from the uC pin.
 
Why did you decide to pull out the NPNs? I'm thinking about doing that as well to reduce complexity... and therefore points I have to troubleshoot when things aren't working right lol
 
Because the way arduino drives the pins I don't think they're really necessary. Pretty much the same reason you just listed.
 
k, I will try that. I've been having issues with getting my circuit to work right. (It works as it is supposed to when I try it on a bread board but when I solder it, it has issues).

Do you still use a current limiting resistor between the uC and the MOSFET? If so, would 333ohm be ok?
 
Yup 330 ohm is exactly what's working for me right now.

I would like to put the npn back in for one reason, to feed 12V instead of 5V to the mosfet. They're supposed to be more efficient that way.
 
The efficiency of the transistor is a function of the way it is biased and its electrical properties. The idea is to limit forward current to keep power consumption down yet still provide enough to drive the transistor into saturation. That is, you want a base resistor as large as possible while still allowing the transistor to be driven into saturation.
 
Sorry to resurrect this thread but I have a quick question about arduino the "EEPROMAnything" function/class thing.

I upgraded my Arduino Software to 1.0 from 2200 and now my code won't compile. I go back to the 2200 software version and it compiles.

The problem so far lies in this code:
(The red is where it throws me an error during compilation, saying that it is expecting something there)

#include <EEPROM.h>
#include <WProgram.h> // for type definitions

template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}
 
Yeah, I'm not using any 1.0 yet, but I think there's something about them killing the byte data type.

Change all the byte to uint8_t and byte* to uint8_t* and see if it compiles.

Send me a PM and copy-paste the errors.
 
Even though you got it solved in that PM, I'm going to post here just for the public knowledge.

That little change is causing more headache in the Arduino community.

The old header WProgram.h that had to be included with all the library headers got changed in Arduino1.0 to Arduino.h. There is a neat and tidy little piece of code that can be added to the front end of your library headers to make them 1.0 compatible.

Thanks to nrbelk for finding this little gem.

* The WProgram.h file, which provides declarations for the Arduino API,
has been renamed to Arduino.h. To create a library that will work in
both Arduino 0022 and Arduino 1.0, you can use an #ifdef that checks
for the ARDUINO constant, which was 22 and is now 100. For example:

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
 
Really nice work!
I added one more pump, and it seems to work, but it still hooked up on breadboard and using a led instead of pump.

I'm trying to add a ds1307 RTC to remember the time in youre code, but i couldn't get it to work, do you have any ideas how to implement that?


I'm a really beginner to programing.

Regards
Jonas
 
All the bits involving time were done using the Time library from the Arduino Playground. Go have a read at that. It explains there how to use that library with the RTC.

I think there is also a library for the RTC that uses the same basic command set.
 
Finely i got the RTC cklock to work.

I added this to the DOSING_COMPUTER_6.pde, DOSE_clock.h and DOSE_head

Code:
#include "Wire.h"  
#include "DS1307RTC.h"
#define current_time getDateDS1307


And added/change this code in DOSING_COMPUTER_6pde
Code:
void loop() {
     setSyncProvider(RTC.get);   // the function to get the time from the RTC    if(timeStatus()!= timeSet)   
 current_time = now();    //  get the time   LCD.clear(); 
  DS1307RTC(current_time);   // and display it

And change all timePrint to DS1307RTC where ever i could fine them in you're files, and now it seems to work!

I even added a 18B20 tempsensor that shows on "home screen"


In DOSING_COMPUTER_6.pde i added
Code:
#define TEMP_PIN  10 //Tempsensor pin // after include files
void OneWireReset(int Pin);
void OneWireOutByte(int Pin, byte d);
byte OneWireInByte(int Pin);



//added this in the  void setup() 


digitalWrite(TEMP_PIN, LOW);
    pinMode(TEMP_PIN, INPUT);




//added this in the Void loop()


int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0x44); // perform temperature conversion, strong pullup for one sec

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0xbe);

  LowByte = OneWireInByte(TEMP_PIN);
  HighByte = OneWireInByte(TEMP_PIN);
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;


  if (SignBit) // If its negative
  {
   // LCD.setCursor(0,1);
     LCD.print("-");
  }
 //LCD.setCursor(15,0);
 LCD.setCursor(9,0);
  LCD.print(Whole);
  LCD.print(".");
  if (Fract < 10)
  {
   LCD.print("");
  }
LCD.setCursor(12,0);
  LCD.print(Fract);
//if (Fract > 10)
{
   LCD.print(" ");
  }
    LCD.setCursor(18,0);
     LCD.print("C");
  delay(50);    

// And at the end i added this

void OneWireReset(int Pin) // reset.  Should improve to act as a presence pulse
{
     digitalWrite(Pin, LOW);
     pinMode(Pin, OUTPUT); // bring low for 500 us
     delayMicroseconds(500);
     pinMode(Pin, INPUT);
     delayMicroseconds(500);
}

void OneWireOutByte(int Pin, byte d) // output byte d (least sig bit first).
{
   byte n;

   for(n=8; n!=0; n--)
   {
      if ((d & 0x01) == 1)  // test least sig bit
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(5);
         pinMode(Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(60);
         pinMode(Pin, INPUT);
      }

      d=d>>1; // now the next bit is in the least sig bit position.
   }

}

byte OneWireInByte(int Pin) // read byte, least sig byte first
{
    byte d, n, b;

    for (n=0; n<8; n++)
    {
        digitalWrite(Pin, LOW);
        pinMode(Pin, OUTPUT);
        delayMicroseconds(5);
        pinMode(Pin, INPUT);
        delayMicroseconds(5);
        b = digitalRead(Pin);
        delayMicroseconds(50);
        d = (d >> 1) | (b<<7); // shift d to right and insert b in most sig bit position
    }
    return(d);
}
It seems to work out all for me.
Tempsensor is only in 0,5 scale.

The code i have added could probably be more sufficient, but I don't care to spend more time to it for now.
 
Back
Top