Code Monkey home page Code Monkey logo

pca9685's People

Contributors

101100 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pca9685's Issues

Version 2.2.0 appears broken

I installed 2.2.0 from npm and when I try and use it as a dependency in a project, I get the error:

Error: Cannot find module 'pca9685'

As I tried to diagnose, I find that the pca9685 module's package.json has main listed as dist/index.js but there is no such directory/file.

PCA9633 compatibility

Good morning,

Is this module compatible with the PCA9633?

Thanks and best regards!

How to reverse the throttle?

Using Adafruit's driver (python), reversing the throttle as easy as:
kit.continuous_servo[3].throttle = 1
and to reverse it
kit.continuous_servo[3].throttle = -1
I am not finding any details about that in the readme or anywhere in the examples. any details?

Thanks

Don't find sample for continuous rotating servos

Hello,
I want to drive continuous rotating servo (for wheel) in "NodeJs" with "pca9685" on RaspBerry Pi. I succeed to drive "angle servo" with command pwm.setPulseLength( port, pulseLen, 0);
I see other commands like :
pwm.setDutyCycle( port, ratio, 0);
or
pwm.setPulseRange( port, min, max);
But I don't know how to drive the continuous rotating servo,

  • in one way and in the opposite way;
  • from null speed to max speed;
    Can you give me sample ?
    Best regards.

when two servos given simultaneous instructions, madness ensues

my setup:
servo on channel 0, controls a turret on a model tank
servo on channel 8, controls the elevation of the cannon

When I run the below code with staggered timeout offsets (offset1=2000, offset2=4000), it all works perfectly. But if I run with the /same/ offsets (4000 for both, for example), the servos appear to lose track of what they were doing.

I'm not familiar with TypeScript, so am not certain I'll find anything in your code, but what it /appears/ to be is a variable from one servo's controller has been set with global scope and is being referenced by the other servo's controller by accident.

  pca9685 = new Pca9685Driver({
    i2c: i2cBus.openSync(1),
    address: 0x40,
    frequency: 50,
    debug: true
  }, function() {
    console.log("Initialization done"); 
  });
  function laserTurretBase(deg) {
    var servoNumber=0;
    if (deg<0 || deg>180) {
      return;
    }
    pca9685.setPulseLength(servoNumber, 1500+Math.ceil((deg-90)/180*1499));
    clearTimeout(timers.laserTurretBase);
    timers.laserTurretBase=setTimeout(function() {
      pca9685.setPulseRange(servoNumber, 0, -1);
    }, 3000);
  } 
  function laserTurretElevation(deg) {
    var servoNumber=8;
    if (deg<0 || deg>180) {
      return;
    }
    pca9685.setPulseLength(servoNumber, 1500+Math.ceil((deg-90)/180*1499));
    clearTimeout(timers.laserTurretElevation);
    timers.laserTurretElevation=setTimeout(function() {
      pca9685.setPulseRange(servoNumber, 0, -1);
    }, 3000);
  }
  laserTurretBase(90);
  laserTurretElevation(90);
  var offset1=4000, offset2=4000;
  setTimeout(function() {
    laserTurretElevation(45);
    setTimeout(function() {
      laserTurretElevation(135);
        setTimeout(function() {
          laserTurretElevation(90);
        }, 4000);
    }, 4000);
  }, offset1);
  setTimeout(function() {
    laserTurretBase(45);
    setTimeout(function() {
      laserTurretBase(135);
        setTimeout(function() {
          laserTurretBase(90);
        }, 4000);
    }, 4000);
  }, offset2);

Enhancement: Provide a speed control

Enhancement request: In my project, I want the servos to move at less than the maximum possible speed. For example, if today going from 0 to 180 degrees takes (and I'm making this up) 1.5 seconds, this would be a rate of 8.3msecs/degree. I would like to be able to change that rate to other values ... for example if I made it 20msecs/degree then a 180 degree rotation would take 3.6 seconds.

Sadly, I haven't studied enough on the pca9685 or this module's internals to say if such a thing is easy, hard or even technically achievable.

LEDs flicker due to PCA9685 load balancing.

I'm getting a lot of flickering when multiple channels have the same off-step.

The PCA9685 uses a load balancing strategy when multiple channels have the same off step. The strategy involves turning all channels to of for a single cycle. This library can be modified to disable the load balancing by changing the PCA9685 object declaration from:

PCA9685 pwmController;
to
PCA9685 pwmController(wire, PCA9685_PhaseBalancer_None);

Disabling the load balancing does seem to clean up the flicker.

I'm rather new to this or I would've tried to figure out how to implement it myself, but is it possible to disable the load balancer in this library?

About ESC

Hello, can I use it to control the ESC? , because they are PWM

Error in the main example

Hi, I think the second line in the example should be
var Pca9685Driver = require("pca9685").Pca9685Driver;
the original version var Pca9685Driver = require("pca9685"); does not work here in my setup (node.js v4.3.2 and RPI 2).

Update i2c-bus version

Hello,

This in already done in fork "https://github.com/fustaro/pca9685" but you should update your i2c-bus version to last one.
Otherwise it cause this error:
_node_modules/pca9685/dist/src/pca9685.d.ts:1:10 - error TS2724: '"../../../@types/i2c-bus"' has no exported member named 'I2cBus'. Did you mean 'I2CBus'?

Error reported when running simple script.

I am running on the May 10th 2016 build of Raspbian on a Pi3. The JavaScript I am running is:

var i2cBus = require("i2c-bus");
var Pca9685Driver = require("pca9685").Pca9685Driver;

var options = {
    i2c: i2cBus.openSync(1),
    address: 0x40,
    frequency: 50,
    debug: true
};
pwm = new Pca9685Driver(options, function() {
    console.log("Initialization done");
});

pwm.setPulseLength(0, 1500);

I am running node.js version 4.4.4.

When I run the script, the error reported is:

$ sudo node test.js
  pca9685 Reseting PCA9685 +0ms
  pca9685 Setting PWM frequency to 50 Hz +16ms
  pca9685 Pre-scale value: 121 +8ms
  pca9685 Setting PWM channel, channel: 0, pulseLength: 1500, onStep: 0 +2ms
  pca9685 Setting PWM channel, channel: 0, onStep: 0, offStep: 306 +2ms
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
  pca9685 Error reading mode (to set frequency) +97ms { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'readByte' }
Initialization done
  pca9685 Setting prescale to: 121 +2ms
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
Error writing to PCA8685 via I2C { [Error: EIO, Input/output error] errno: 5, code: 'EIO', syscall: 'writeByte' }
/home/pi/projects/bubbles/node_modules/i2c-bus/i2c-bus.js:244
    i2c.writeByteAsync(device, cmd, byte, cb);
        ^

Error: EINVAL, incorrect arguments passed to writeByte(int fd, int cmd, int byte, function cb)
    at Error (native)
    at Bus.<anonymous> (/home/pi/projects/bubbles/node_modules/i2c-bus/i2c-bus.js:244:9)
    at Immediate.immediate._onImmediate (timers.js:440:18)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Error initializing PCA9685

hi,
when i run the example servo.js i get this error:

  pca9685 Reseting PCA9685 +0ms
Error initializing PCA9685

when i copy paste the example under usage from the https://github.com/101100/pca9685 i get a positive output

Initialization done
Pulse range set.
Channel 6 is off.

i started looking in these examples because i get this Error initializing PCA9685 in node-red-contrib-pca9685 aswel

any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.