Hi I was hoping to start my first project with the photon particle and I’d like to have the photon control 6 servos independently and set their angles.
I was wondering if someone could suggest how best to power something like this from a transformer plugged in to the wall etc and what that wiring might look like. I’m from a software background and now looking to have a tinker.
It might be good to use a shield or for something simpler, you will want a AC --> DC supply of 5V to power the Servo separately from the Photon.
Thanks for the reply Kenneth!
Just wondering what kind of power 4 servos would require? are there any good beginner articles on getting started with wiring/power?
For wiring, Servo comes with 3 wires:
servo ---> Photon
+ ----> +5V
s ----> signal (Digital IO)
- ----> gnd
We might have to look at the datasheet of the servo to determine how much power is required from the module.
This might be good: https://www.arduino.cc/en/Tutorial/Sweep
For a stationary hobby project, you can just pick large components and not worry about it. For example, if you take a 5V DC 2A power supply and connect it to the voltage pin of all 6 servos and to the VIN pin of the Photon you’ll have no problems. You can use a solderless breadboard to make the connections.
Here’s a power supply tutorial by Sparkfun.
Wow thanks very much @kennith and jvanier most appreciated! I shall start things off and let you know how I go
And where would you wire the 5vdc supply to? or would you cut off the barrel end and use one for a positive power bank and the other for earth?
Sorry I am very very green
You could use a barrel jack compatible with a breadboard.
Cutting the wires is also fine. One trick I did is to solder a cut leg of a resistor to each of the wires from my 5V power supply. This way the legs are stiff and I can connect them to the breadboard. Trying to connect loose wires into a breadboard is an exercise in frustration!
Since you are beginning, you can learn a lot by reading the tutorials and projects published by Sparkfun and Adafruit. I have a huge amount of respect for the resources these 2 companies dedicate to teaching the maker community and I frequently buy things there.
Keep it up and have fun!
Thanks again Jvanier!
Just wondering if I need to drive those 6 servos from the photon would it be better to get a red and use an arduino servo driver or could the photon handle running 6?
I’ve used a PCA9685 16-channel I2C PWM servo driver with Spark Core (maybe it was the Photon, it doesn’t really matter in this case). Adafruit has a handy breakout board for it, and it connects easily to the I2C interface. It requires its own power supply, which makes sense for that many servos, but it was super-easy to work with and I recommend it.
Did you need any extra libraries or a port of a library to get started with it?
It was a while ago, but I think I just wrote I2C commands to it using the built-in Particle Wire class. However just do a search for PCA9685 in the Web IDE libraries tab and there’s a library ported from the Adafruit Arduino library. I haven’t used it, but it looks like it should work and would be easier.
Thanks Rick! I’ll take a look
The Photon has 7 independent PWM outputs, so you could drive 6 servos from the Photon.
did you find this Arduino adafruit library to port over?
I did find one in libraries. My main issue is the wiring. Some people say pull up resistors are required on the i2c line some say that’s not the case. When looking at the arduino port it is appears to be a port for LEDs I’m assuming it will work similarly and I can just write some helper functions to convert degrees to pulse length like so: ((degrees * (servoMax - servoMin)) / 180) + servoMin or using a map function…
To clarify here:
Having pull-up resistors on an I2C bus IS definetly absolutely required.
otherwise it’s not an I2C bus in the meaning of the term
But if you have to add them yourself depends on the devices you use.
At least some Arduinos come with them already in place on the board, some I2C devices come with them on already, but the Particle devices (excluding shields ) do not come with I2C pull-ups in place, so you have to make sure they are in place one way or the other.
Thanks very much for the reply.
So from the Particle what on d0 and d1 what would the wiring then look like sorry? I’m brand new!
On the Pi and Ardunio forums there were members saying > Some devices want a VDD of 5 volts, others like the PCA9685 will take anything from 2.3 to 5.5 volts, etc.
So if I need a pull up from 3.3 -> 5 could I use something like this? https://www.sparkfun.com/products/12009
The I2C pins D0/D1 are 5V tolerant, so if you have a 5V sensor you can just take one 4k7 resistor from D0 to Vin and another D1 to Vin (unless your sensor has its own pull-ups already - as stated above) and also just wire D0/D1 to the I2C device too.
If you have an 3.3V I2C device pull the resistors to 3V3 instead of Vin.
You don’t need level shifting chips like the one you linked.
This page shows it quite clearly