Auto hand senitizer

Hi guys... Iam trying to make hand senitizer with ultra sonic and pump motor and arduino..... My connection is as follow

The pump motor to the motor driver
The two pins of motor from motor shield to arduino..
3 lithium battery to the motor shield.. Then taking 5v to the arduino from motor shield
.
Then taking 5v from the arduino to the ultra sonic

.......
My proplem now is : it was working good but now it doesn't work I don't know why... The pump motor doesn't pump.. Is this a voltage proplem... Guys I really need you help. And I will appreciate any help...+thanks

And we need Your help to help You.
Please read the first topic telling how to get the best out of this forum:
How to get the best out of this forum - Using Arduino / Project Guidance - Arduino Forum

Waving with a wet handkerchief gives helpers no ideas.

I know I abit difficult to understand but I can provide you with everything you need to help me... I will try my best

schematic +code please

Show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

Another hand sanitizer thread. I'm washing my hands of this. Just kidding.
When is this project due?

2 Likes

Just waiting for "yesterday".....


There is my wiring
3lithium batteries to the motor shield 12 v the from the motor shield 5v out to the arduino the From the arduino I take 5 v to the ultrasonic sensor.....
The ultra sonic trig pin is to pin 6 of the arduino
The ultra sonic sensor echo pin is to pin 5 of the arduino
..
And I can't send the schemitic because I have invited it by myself... But it was working really good until I added an isd recording module that braked every thing...

Note: when I added this module I shared the 5v of the arduino pin to the ultrasonic and to the module by bread board

I really need help I have a competition on Wednesday and I will be suspended if I didn't finish this project

But we have no idea what’s going on without it.


You are refusing to help us help you :thinking: .

Ahh I really don't know what to do iam a loser I always lose... And now iam losing everything

If you can read my message and it contains every thing about the schemitic

Good luck, enjoy your hobby.

Whyyyyy is everybody so rude.. If you was me you would. Be crying about this... But you are not me... So you decided not to help because you are not in my place.. So thanks

Volunteers here are more than happy to help people with projects when those people supply the information requested.

Below is a Sketch and schematic offered to help a new user about a a year ago.

The user was also doing a hand sanitizer project.

Sketch


//********************************************************************
//                   YY/MM/DD
// Version 1.00      20/06/10        Running code
//
//********************************************************************

#define motorON                      LOW        //change as needed, most relay cards need a LOW to pick the relay
#define motorOFF                     !motorON

#define handDectected                LOW        //sensor gives a LOW when an object is detected, change as needed

const byte sensorPin               = 2;         //IR sensor connected to pin 2
const byte motorPin                = 8;         //motor relay connected to pin 8
const byte heartbeatLED            = 13;        //toggles every 500ms, acts as a heartbeat indication

byte lastReadSensor;                            //the state the sensor was last in

bool pumpFlag                      = false;     //true means the pump is on
bool waitFlag                      = false;     //false means we 'can' check the hand sensor

//timing stuff
unsigned long currentMillis;
unsigned long heartbeatMillis;

unsigned long checkSensorMillis;

unsigned long pumpMillis;
const unsigned long pumpOnInterval = 3 * 1000ul;  //the pump is on for 3 seconds

unsigned long waitingMillis;
const unsigned long waitInterval   = 2 * 1000ul;  //wait 2 seconds before we allow more dispensing

//********************************************************************
void setup()
{
  pinMode(sensorPin, INPUT_PULLUP);
  pinMode(motorPin, OUTPUT);
  pinMode(heartbeatLED, OUTPUT);

  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);

} //END of setup()

//********************************************************************
void loop()
{
  //save current time
  currentMillis = millis();

  //********************************
  //to help show if there is any blocking code, this LED toggles every 500ms
  if (currentMillis - heartbeatMillis >= 500)
  {
    //start this TIMER
    heartbeatMillis = currentMillis;

    digitalWrite(heartbeatLED, !digitalRead(heartbeatLED));
  }

  //********************************
  checkSensor();

  //********************************
  //pump ON TIMER
  if (pumpFlag == true && currentMillis - pumpMillis > pumpOnInterval)
  {
    //disable this TIMER
    pumpFlag = false;

    digitalWrite(motorPin, motorOFF);
    Serial.println("DC Pump is OFF Now!!");
    Serial.println("");

    //enter the waiting phase
    //start the TIMER
    waitingMillis = currentMillis;

    //enable the wait TIMER
    waitFlag = true;
  }

  //********************************
  //waiting phase TIMER
  if (waitFlag == true && currentMillis - waitingMillis > waitInterval)
  {
    //allow sensor checking
    //disabel this TIMER
    waitFlag = false;
  }

  //********************************
  //other non blocking code
  //********************************

} //END of loop()


//********************************************************************
void checkSensor()
{
  byte readStatus = 0;

  //************************
  //can we check the sensor yet ?
  if (currentMillis - checkSensorMillis < 50)
  {
    //no, it is not time to read the sensor
    return;
  }

  //restart the TIMER
  checkSensorMillis = currentMillis;

  //************************
  //read the sensor
  readStatus = digitalRead(sensorPin);

  //has the sensor state changed ?
  if (lastReadSensor == readStatus)
  {
    //no change
    return;
  }

  //save the new state
  lastReadSensor = readStatus;

  //if we are allowed, has the hand been detected ?
  if (waitFlag == false && pumpFlag == false && readStatus == handDectected)
  {
    //start the TIMER
    pumpMillis = currentMillis;

    //enable the pump TIMER
    pumpFlag = true;

    digitalWrite(motorPin, motorON);
    Serial.println("DC Pump is ON Now!!");

  }

  //************************
  //other sensors or switches
  //************************

} //END of  checkSensor()

Schematic offered to the new user.

It’s too bad you cannot see fit to supply the information we ask for as we could do for you as we did for them.

This user has wasted too much time on this thread, success to you.

I can't use his schemitic nor his code because iam using ultrasonic sensor not ir.... And my schemitic I right also my code because as I said the project was working fine until I added the isd recording Module..then it doesn't work..

And sorry for being rude with you but Iam really afraid that I can't do this project and I lose the competition

So I think the proplem happened when I added the isd recording Module...

The motor is shaking but not moving... It is like zigzag and when I gave it a push by my hand it moves... Does this mean it is a proplem in voltage

Okay, one last time.

Show us a schematic and show us your code.

Without seeing these two things we cannot help you.


BTW
If you are feeding 5v from the motor driver board to the Arduino Vin pin this will not work.

Here we are left guessing what you are going because everything is top secret .


It’s bed time here now. :sleeping_bed:

Suddenly I don’t feel like helping, sorry, but good luck with beating all other competitors

Iam sorry I didn't know its bed time in your area...
Answering you question is yes iam providing the arduino by 5v from the motor shield

If you are feeding 5v from the motor driver board to the Arduino Vin pin this will not work.

Here we are left guessing what you are going because everything is top secret .