I need help getting the parallax 360 continuous servo working with Arduino. We managed to get speed and direction working but we were unable to get any feedback from the feedback wire. We are running this from an Arduino mega plus an adafruit motor shield V2. We want to be able to count the rotations made by the servo and write to a particular angle. We want to do this via the hall effects sensor instead of the time. We are open to all suggestions.
Check out page 5 of the datasheet:
There is example code there for how to read the position of the parallax 360. Its pretty involved since it uses PMW to send the signal. You won’t really be able to read the signal without some code to interpret it. I suggest starting with the example code and working on from there!
I hope that helps! Let me know how the project progresses!
Hi, thanks for the response. Had a look at that, tried to get it working but i called parallax and they said it specifically works on their boards. the motor feedback signal works at 910hz and the Arduino PWM frequency is different. not sure how big a problem this is or if it can be fixed. any further suggestions?
You shouldn’t have any problems reading a 910hz signal. According to the pulseIn() documentation, an Arduino should be able to detect pulses down to 10 microseconds, which is 100kHz, and as long as 3 minutes.
Here is another article to help:
Use method 1.
Hopefully that gets you started!
Worth noting that PulseIn() is a software-based function, so it’ll only work “that one time when called”.
If you want to measure every single tick of that signal, use an interrupt instead. The ATmega328 has several hardware interrupts for pin-change events, allowing you to create timers that count the time on versus off. From there, your interrupt can be extended to increment other variables that accumulate past measurements and translate those into speed and distance, etc.
Ensure you use an input pin that has a Schmitt Trigger on it. This will greatly reduce hysteresis, which can occur when there are noisey devices in the circuit (such as a motor).
Please do head on back afterwards and share your build/code, we’d love to see it!
Hi, thanks for the help. Would you have any sample Arduino code to get me started as I am very new to this.
You can find some example code here that will get you started:
People seem to have the most luck with Method 1.
Try that out and let me know how it goes.
I’d tried method one, doesn’t seem to work
this forum here managed to somewhat make it work but the code doesn’t work when I run it.
What am i doing wrong?
It’s always hard to debug by proxy. So I can better help you out could you please share a wiring diagram of how you have everything hooked up. Fritzing is great for this. Also can you please share your code?
Once I get that I’ll be better able to understand the situation