Attiny85 and motor control

Hi all,

How can I control 2 servo motor with attiny85,

I didn't find tutorial or anything else,

Please help

Thanks

I would start controlling one and ALL the stuff involved in that sentence (programming, etc)

Do you have one working already?

Connect the second to another output pin of your ATtiny85; create a second Servo object; and you should be good to go.

No, I didn't have working one yet,
I post this question because I don't know how to do for control servo with attiny85,
I didn't find a tutorial about this subject, please help !

Thanks

I find a video about that :
video link

but I don't know how to do that

The default Servo library does not support the ATTiny85.

If you use ATTinyCore (installable through board manager using the json file in my sig), there is a built-in Servo library that DOES, however! (it otherwise behaves the same as the default Servo library, so code written for normal Arduinos will "just work")

If you've installed Servo (either manually or using board manager), however, it will use that (which doesn't support the t85) instead of the one supplied with the core (which does) - to handle that, recent versions of ATTinyCore also provide a copy of the t85-supporting version of Servo named Servo_ATTinyCore (identical except in name, so the IDE won't use the manually installed version of Servo)

Can you make an example of the source code
for controling 2 servo please ?
And what are the wiring between the attiny and the servo.

Thanks

Unnamedmaker:
I'm a beginner on arduino and attiny can you tell me how I can install attiny core and how to use it please ?

ATtiny projects are not beginner projects by a long stretch. Programming and especially debugging are much harder than on an Arduino (no Serial interface).

Start by getting your project working on a regular Arduino, then consider the move to an ATtiny and working with ATTinyCore (link because you're too lazy to even google that yourself).

DrAzzy:
If you've installed Servo (either manually or using board manager),

Doesn't it come installed by default with the IDE? I don't remember having had to install it manually.

I edited my post because I find how to install attiny core .
Someone can make a code example for control two servo? please

Thank you

Start with the sweep example, and other Servo examples of the IDE.

Thanks for your answer,

I find servo examples but they use the pin 9 and I don't understand why

I know the Attiny85 had only 8 pins so why it is the pin9 wich is used in those example ?

Can you tell me what wiring I need to do between Attiny85 and the servos

Unnamedmaker:
Thanks for your answer,

I find servo examples but they use the pin 9 and I don't understand why

It's a nice number.

I know the Attiny85 had only 8 pins so why it is the pin9 wich is used in those example ?

Can you tell me what wiring I need to do between Attiny85 and the servos

The problem is that you quite obviously have NO CLUE of what you're talking about.

Do you even HAVE a servo and Arduino board of sorts?

If so, did you get any servos working already with it?

Do you even have an ATtiny85, and how do you (plan to) program the thing?

If you answer to any of those questions is "no", go do something about that instead of wasting our time with pointless questions that are way ahead of where you are now.

On the attiny85, you must use a pin number which exists on the chip - this would be 0~4 (it's an arduino pin number, not physical pin number). Any pin that is usable as normal I/O can be used to control a servo.

I would second the advice of making an identical sketch work on a normal arduino, and then moving to the attiny, so you can separate out problems related to the attiny85, vs problems relating to the sketch.

Since you seem to have no idea what you're doing, let me point out four common issues:

  • You must have a 0.1uF capacitor between Vcc and Gnd of the attiny85 for stable operation. Without it, unexpected resets, hangs, or more complicated unintended behavior may occur (the same holds true for nearly any digital IC - unfortunately, it sometimes does work, or kind of work, under some conditions, which has led to a proliferation of bad guides and tutorials which omit these so-called decoupling capacitors - very few people qualified to write tutorials want to do so, so the tutorials are frequently written by people who aren't).
  • You must do "burn bootloader" with the clock source you want selected in order to set the fuses so that it actually runs at the speed you intend (virgin tiny85 comes set for 1MHz internal). Yes, even though you are not using a bootloader. Do not set it to use a crystal unless you are using one - this will brick the chip, preventing all further programming until you provide it with a crystal or clock source.
  • Servos, and motors in general, use a non-trivial amount of current (see the specs on the servos you are using) - make sure the power source for the servos can provide that.
  • Servos, and motors in general, are inductive loads. They can put a lot of noise onto the power supply - enough to reset the microcontroller controlling them. Ideally, you should use a separate power supply for the microcontroller and servos - where this is impractical, additional power supply filtering is typically required. Where multiple supplies are used, the grounds must be connected; the positive rail of the two supplies must not be.

Ok, thank you very much