Would you be so kind as to give me a little direction.
In an attempt to switch my products from raspi gpio to adafruit usb gpio.
The main task is to send PPM signal to a speed controller (flipsky 75200 esc)
On raspberry pi i do it like this.
----------------------------------------------------
import pigpio #importing GPIO library
pin=18 #Connect the ESC in this GPIO pin
pi = pigpio.pi();
max_value = 2500 #ESC's max value
min_value = 500 #ESC's min value
pi.set_servo_pulsewidth(pin, 1500) #initial setup
# set vv to a speed from 500 to 2000
pi.set_servo_pulsewidth(pin,vv) # change speed
---------------------------------------------
What would be the equivalent code to perform pulse width on the product
i just ordered?
This would be so much help if anyone you can steer me in the right direction
I prefer nodejs however python is ok if no nodejs.
Basically trying to send ppm signal via gpio to control pulse with in range of 1 to 20ms
MCP2221A Breakout - General Purpose USB to GPIO
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
No replies is very frustrating. since there is not much online supporting nodejs and adafruit i'm stuck
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
no sir it does not. in fact im so frustrated now i just gave up. Its just adding complexity where it doesnt need to be.Franklin97355 wrote:Does this help?
- sj_remington
- Posts: 1000
- Joined: Mon Jul 27, 2020 4:51 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
The MCP2221A is not designed or intended for uses like generating PWM pulse trains.
USB servo controllers are available, such as the Pololu Maestro.
USB servo controllers are available, such as the Pololu Maestro.
- adafruit2
- Posts: 22149
- Joined: Fri Mar 11, 2005 7:36 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
MCP2221 absolutely does not support PWM output - you cannot use it for such a purpose! only I2C, UART, and GPIO
[MOD EDIT] removed mention of SPI, which MCP2221 does not support. The FT232H does though: https://www.adafruit.com/product/2264
[MOD EDIT] removed mention of SPI, which MCP2221 does not support. The FT232H does though: https://www.adafruit.com/product/2264
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
Also several I2C based options based on the PCA9685. No MCP2221A needed. All Pi's have I2C available on the GPIO header.
HAT:
https://www.adafruit.com/product/2327
Bonnet:
https://www.adafruit.com/product/3416
Breakout:
https://www.adafruit.com/product/815
HAT:
https://www.adafruit.com/product/2327
Bonnet:
https://www.adafruit.com/product/3416
Breakout:
https://www.adafruit.com/product/815
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
Its not pwm its PPM SIGNAL .. however this mcp2221 DOES SUPPORT DAC so i can throw the signal to the vesc that way. already got it working will test on motor tomorow. only 32 settings but i think doable 'rather have it be 8 bit' than 5bit precision .adafruit2 wrote:MCP2221 absolutely does not support PWM output - you cannot use it for such a purpose! only I2C, UART, and GPIO
[MOD EDIT] removed mention of SPI, which MCP2221 does not support. The FT232H does though: https://www.adafruit.com/product/2264
Is there any script where i can also hook up HMC5883L compass via SDA/SDL ETC on MCP2221
I do not see any python script for this but looks like it should work?? Any solution to adding my compass?
This is pretty exciting now. If i cant do hmc5883l compass with mcp2221 is there another USB/PYTHON solution from adafruit?
thanks!
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
It would be possible if there were a Python (or CircuitPython) library available. However, the HMC5883L is an older and now discontinued product:
https://www.adafruit.com/product/1746
and there is only an Arduino library available:
https://github.com/adafruit/Adafruit_HMC5883_Unified
The MCP2221 simply provides the I2C bus. If you can find a Python library for the HMC5883L that allows passing in an arbitrary I2C bus instance, then it might work.
https://www.adafruit.com/product/1746
and there is only an Arduino library available:
https://github.com/adafruit/Adafruit_HMC5883_Unified
The MCP2221 simply provides the I2C bus. If you can find a Python library for the HMC5883L that allows passing in an arbitrary I2C bus instance, then it might work.
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
HOW? can you see if one exists I am not a programmer . just point me to a script or if you have another way i can get my compass input via another product that has KNOWN SCRIPT that would be helpful too i will buy that too.adafruit_support_carter wrote:It would be possible if there were a Python (or CircuitPython) library available. However, the HMC5883L is an older and now discontinued product:
https://www.adafruit.com/product/1746
and there is only an Arduino library available:
https://github.com/adafruit/Adafruit_HMC5883_Unified
The MCP2221 simply provides the I2C bus. If you can find a Python library for the HMC5883L that allows passing in an arbitrary I2C bus instance, then it might work.
- adafruit2
- Posts: 22149
- Joined: Fri Mar 11, 2005 7:36 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
these compasses
https://www.adafruit.com/product/4488
https://www.adafruit.com/product/4413
https://www.adafruit.com/product/4479
should be workable as they have python drivers
https://www.adafruit.com/product/4488
https://www.adafruit.com/product/4413
https://www.adafruit.com/product/4479
should be workable as they have python drivers
- tinkertiger
- Posts: 6
- Joined: Wed Jun 01, 2022 9:22 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
None seem to be usb :( i want to use laptopadafruit2 wrote:these compasses
https://www.adafruit.com/product/4488
https://www.adafruit.com/product/4413
https://www.adafruit.com/product/4479
should be workable as they have python drivers
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: MCP2221A Breakout - General Purpose USB to GPIO
They can be used in conjunction with the MCP2221A. The MCP is what provides the USB to I2C bridge for talking to the I2C based sensors from a PC's USB port.
Please be positive and constructive with your questions and comments.