I have a Lolin MCU like this Lolin v3
I have a PCA9685 board like this cheap controller
And Im coding in microPython in the nodeMCU device. I managed to attach one of those small 9g servos to the nodeMCU board and controll it. No problem. I want to use a controller since I need more servos, so I connect the PCA like this:
PCA V+ <--> 3v3 in the mcu (5v produce no changes)
PCA GND <--> GND in the mcu
PCA SDA <--> SDA (Pin 4) in the mcu
PCA SCL <--> SCL (Pin 5) in the mcu
PCA OE <--> GND, V+ or open. Makes no difference
Now I downloaded this PCA9685.py and Servo.py from this web microPython PCA controller
I create an I2C like this
>>> i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
>>> i2c.scan()
[64, 112]
So the device is there. The cables are good, the i2c is working. But the servos won't move no matter what. Not even buzz.
I try moving the servo using
servos.position(1, us=1500)
no thing happened.. I connected several servos in several ports to make sure is port 1 not port 0 and those stupid errors.. nothing.
This is the code I'm running at the device right now:
from machine import I2C, Pin
import servo
servos = servo.Servos(I2C(scl=Pin(5), sda=Pin(4))
for i in range(16):
servos.position(i, us=1500)
Any clue ???
Related
I am a newbie to STM32 and CubeMX. I need to create 3 UART interface and 2 I2C interface in STM32F103C8T6. I tried to, but there is a common port for both i2c and uart communication and it allows me to create only (2 uart and 2 i2c) or (3 uart and 1 i2c ) and I couldn't create as I needed . how can I establish 3 UART and 2 I2C interface at a same time in STM32F103C8T6 ?
Thanks in advance...
You can't. There's an unresolvable pin conflict.
The I2C2 peripheral must use pins PB10 and PB11 for SDA and SCL -- there are no remappings for this peripheral.
The USART3 peripheral uses those pins for TX and RX. On higher pin-count STM32F1 parts, it can be remapped to pins PC10/PC11 or PD8/PD9; however, the STM32F103C8 doesn't have those pins.
There are only two I2C and three USART peripherals on the STM32F103, so there are no alternate I2C or USART peripherals available.
use hardware I2C and as many as possible hardware UARTS. For the additional ones write the software implementation. You have an example here: https://www.st.com/resource/en/application_note/dm00110292.pdf or take stm32F103 with more pins
I am trying to use the Sparkfun nRF52832 breakout board as a master in I2C communication. I am using Arduino IDE to program the module. I defined pins 24 and 25 as SCL and SDA, respectively, and used wire.begin() in the setup to configure it as a master. I expect to see the clock signal when I connect the board to the oscilloscope, but I just see 3.3v dc signals at both scl and sda pins. Would you please tell me what's wrong?
I used pull-up resistors.
I am working on a robotic project and encountering difficulties in controlling two Dc motors. Anyway, I am using raspberry Pi 3 and Dual Channel 10A DC Motor Driver to drive two DC motors (Dual shaft self-locking DC worm gear motor). I am using the driver to drive bigger motor capacity and make them work as a servo motor. I managed to send signal and run the motors but I can't stop them running. Please any help, I would be thankful.
Import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12,GPIO.OUT)
pwm=GPIO.PWM(12,100)
pwm.start(20)
time.sleep(1)
pwm.stop()
In fact, I have little knowledge on controlling the motors.. if you can guide me or show me good reference I will also be grateful .
I'm trying to talk via I2C to the gyro sensor MPU6050 which sits on a GY 521 board. But i can't get the device being detect.
I tested another i2c device (EEPROM) and got the device address detected. So i guess it has to be a hardware problem.
As far as i could find out:
RPi has a 1.8k pullup resistor on SDA and SLC already on board
my GY 521 also has also a pullup resistor (2.2k) on each line on board
Could the resistors be the problem? A good resistor value in sum would be around 5k on each line?
(The wiring should be ok, there are a lot of instructions around the net and i've checked it multiple times. I use 5v on the GY521 since it has a voltage converter)
Any help appreciated!
The problem was bad soldering.
For the record:
Using the RPi pullups in combination with the breakout board pullups works for me.
I am trying use GPIO to simulate pwm output to control a servo on my raspi B board. But the servo keep shaking and can't stop in a expect postion. Any one know the reason about that?
The source code may like below:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(12, GPIO.OUT)
vertical = GPIO.PWM(12, 50)
vertical.start(14)
time.sleep(0.2)
vertical.ChangeDutyCycle(0)
I add a PCA9685 which is an I²C-bus controlled 16-channel PWM output between Raspi and servo. The servo can works correctly.
My guess is that Linux run on Raspi is not RTOS. So PWM output may not stable.