Gearmotor program

Hello, I have some problem with my gear motor, its reference is 918D15112 / 1, Gearbox 15:1, 4mm shaft.
I try to make it work by turning in one direction or the other depending on the temperature and humidity, measure by our sensors (which work perfectly)
But I do not know how to do this program if you could help me.
Thank you. :slight_smile:

NouileOrc:
Hello, I have some problem with my gear motor, its reference is 918D15112 / 1, Gearbox 15:1, 4mm shaft.
I try to make it work by turning in one direction or the other depending on the temperature and humidity, measure by our sensors (which work perfectly)
But I do not know how to do this program if you could help me.
Thank you. :slight_smile:

You will need a motor controller or shield, and a 12V supply capable of perhaps 1A
(enough to handle temporary overload). Do you have such?

We did the 12V and the motor operates manually by touching the terminals with wire, but we want it to work automatically.

Welcome to these forums. Help for you is available but you have to help yourself first. You must do some homework on your own to gain an understanding of what to do to get yourself started in your endeavor. To do so, simply Google 'Arduino DC motor' and read. If you do so, you will then understand enough to allow you to proceed on your own, at least enough to ask specific questions. Your original post seems to request 'take my hand and do this project for me'. - Scotty

It sounds like you'll be needing a motor driver / controller / shield. Arduino pins
cannot handle 12V directly and cannot handle the current levels drawn by even
a small motor.

There are many available, perhaps a bewildering variety... Most are dual H-bridge
controllers using either the L293D, L298 or a MOSFET H-bridge chip. Usually good
to 1A and 24V, but you should check the specifications for a particular board.

"Your original post Seems to request 'take my hand and do this project for me' "

I know, but this is because it is for a project in my school and they we only have two weeks to finish, and do it a moment I'm looking how, suddenly, I just ask for your help.
I know it will not help me because I do not teach or little, but otherwise we will not have time to finish ...

If you have some of your code written post a copy of it. (and use code tags (the # button) so it looks like this)

...R

Write your programme to do the following
a) Manually input set points for temperature and humidity
b) Measure temperature and humidity (measured variables)
c) If measured variables equal set-point then motor drive = zero
d) If measured variables exceed set point then drive motor clockwise
e) If measured variables are lower than set point then drive motor anti-clockwise

You can add a further function in that the motor speed is set as a function of the error between setpoint and measured variables. This can be achieved by using a PWM output.

Edit : And once you have that up and running you can also introduce Integral and derivative functions so you end up with a fully operational PID controller.

As others have said you will need an H-drive

Be aware that you cannot drive a DC motor to a known position unless it has some form of position sensor fitted. If you do require predetermined positions you need to use a servo motor.

#include <Servo.h>

Servo servo_pin_2;
int _ABVAR_2_tempe;
Servo servo_pin_1;
int _ABVAR_1_humi;

void setup()
{
_ABVAR_2_tempe = 0;
servo_pin_2.attach(2);
servo_pin_1.attach(1);
_ABVAR_1_humi = 0;
}

void loop()
{
if (( ( _ABVAR_1_humi ) < ( 60 ) ))
{
servo_pin_1.write( 360 );
}
if (( ( _ABVAR_2_tempe ) < ( 18 ) ))
{
servo_pin_2.write( 360 );
}
}

I do that with ardublock, but I have not tried it yet, and I can not until Monday.
Thank you Jackrae, I'll try it Monday.