Please help me if you can :(

does enyone know how to code a vibration motor and flex sencors?
i need a lot of help
thanks

@jayfeather29 ,

Welcome.

As your topic does not seem to be concerned with interfacing to software on your computer I have moved it to a more suitable location.

Could you also take a few moments to Learn How To Use The Forum.

It will help you get the best out of the forum in the future.

Thank you

You will need to read about "transistors, diode, motors" to drive the vibration motor.

The flex sensor will use an analog input.

This guy had some code...

i saw the post but it dident really help :(

Thank you I will try to take the guide into concideration in the future.

1 Like

How did it not help? It had one syntax error to correct, and the original poster said the correction fixed the issue. Do tell...

We need to know something about your motor and sensors, post brand names and exact part numbers for each or weblinks to the seller's web pages where you bought them.

please apply it now…

1 Like

What more do you need to know other than using a transistor to supply a higher current to the motor and measure the voltage across the sencor in series with a resistor to detect how much it is bent?

What compiler are you using? Arduino IDE?
What type of board are you using?
Uno R3, R4, ESP32?
Do you have datasheets of the sensors and motor you are programming?

All these are basic needs to build and code your project. The wrong motor can fry your board. An electric motor has an inrush current to start the motor spinning, most times it's best to use a driver or special circuit to drive a motor. When the motor stops or is put under a load, voltage spikes can also happen. (Research Lenzs law, Faradays Law). These laws apply to solenoids, mechanical switches, etc.

Welcome to Arduino forums :grinning_face_with_smiling_eyes:

2 Likes

thank you for welcoming me to this fourm. I am using Arduino IDE the board that im using ia a Arduino UNO R4 WiFi. no i dont have any datasheets.

The Arduino output pins cannot supply enough current to power a motor, even a tiny motor. You have to use a transistor switch for the higher motor current but first you need to know the motor's voltage and current or wattage to select the proper transistor. There are 3 volt, 5 volt and higher voltage vibration motors.
What is the voltage of YOUR motor?
There are many different flex sensors, what is the resistance (in Ohms) of YOUR sensor when it is NOT flexed and when it is fully flexed?

The Arduino R4 wifi has a very low output current. You need to read the datasheet on the board.
I own one myself and I love it. However it has a very low usable out put current even LEDs can cook it if you aren't careful.
It can only output 8mA per I/O, so as a general rule I only use 5mA out of the 8 available. I don't like cooking if it's not food :upside_down_face:
General rules of thumb:
Don't hook any inductive loads to the board.
Use a Logic Level Mosfet to drive anything bigger than an LED.
Make sure the LED you use has a datasheet and KNOW how much current something draws before you connect to this board. Adjust your resistors to LEDs.
Lots of guides here are for the UNO R3.
Make sure before following a schematic it's not made for an UNO R3. The code is mostly (and I do mean mostly, its not always) compatible. The schematics are not.
IRLZ44N is a popular logic level Mosfet that works very well on the R4. You are going to need some. They are inexpensive.
L298N is a good H bridge for driving motors, or you can get an Arduino shield for motors that simply stacks on the R4.
This is your safer option.
Finally properly power your board with a wall adapter. A USB connection isn't going to have the oomph to power a motor.

Have fun. Don't cook anything except food :hot_pepper:

Wanted to follow up and say an H bridge is basically a switch that makes a motor run in forward and reverse. Think of a power window switch.
Since we don't know if you have a stepper motor, a regular old motor from a shaver, etc we just don't know.
How much voltage does it take to make it go vroom? If it's 6 or 12V just a Mosfet will do, like the one I mentioned.
Get a gate resistor and a flyback diode and learn the circuit. Put it together and you are in business. (Lots of guides online for this and I'd have to write you a book)
Hope it helps!

Really!

A chip that has been obsolete since before the start of this century?

The big problem with it is that it has too much voltage drop, So even to drive a 5V motor it will require at least an 8V power supply.

@jayfeather29

Face it you also bought the wrong board when you chose an R4, get an R3.

1 Like

Yeah it's obsolete but it works.
I still use CD4000 series chips for some things :joy:
I laugh because I hang onto things that I know that 'just work'. I actually like being able to do more with less when possible

Obsolete yet sold everywhere, cheap and easy to get. Digikey has 10k in stock. And it accepts a wide range of voltages :person_shrugging: what's not to like there. (Except it doesn't have mosfets and it gets hot)
But I forgot you are Grumpy Mike :upside_down_face:
(This is a friendly joke don't throw more darts at me I'm sensitive😂)

Yeah the R3 is much easier to work with. I agree. Where the R4 comes in is Bluetooth capability and Wifi. If you don't need that well, R3 is the way to go.