# Controlling PWMs through hardware

I tried searching for this (both here and on Google) and didn’t find anything so I’m sorry if it’s already been covered. If this is in the wrong section, I’m sorry too, feel free to move it (if that is possible).

My team is building (long story as to why) a scooter-like device using FRC parts, but we have one restriction: because our robot’s code was wiped out when our school’s IT guy ‘accidentally’ wiped our programming computer’s hard drive (and yeah, we had backups, and my hard drive died some months ago, and the backup usb stick was lost, and …I know, we need to be more careful) and we have an off-season soon, so we can’t use the cRIO for this scooter project. We thought of using the old 2007/2008 (and earlier) system, but we can not find neither software nor anyone who remembers much about it. We came to the conclusion that the only option is to build something custom using two victors connected to some custom hardware that we are (hopefully) capable of making.

The big question is if this is possible in any way directly through some sort of lever ( we thought of using a potentiometer but the thought of the waisted electricity makes us shiver)to control the PWM signals sent to the victors?

Does anyone know where we can find what data is transmitted on which wire and the ‘protocol’ involved.

All we want to do is have two motors with some sort of variable speed, without having to use a control system.

(If anyone has a better idea, all ideas are accepted: keep in mind though, we are outside of the states, so ordering electronics from the USA is slightly more complicated here)

Thanks in Advance -
The Spikes 2212

EDIT:
I just managed to find the Jaguar’s technical specs pdf and according to what I found there the three pins are 1)PWM 2) 5V(optional, doesn’t need to be connected- can be ignored) and 3) Ground

2 can be ignored, and 3 is easy to figure out to do with (ground), but with 1:PWM
the refresh rates for the PWM format are:
-1= 0.67ms
0 = 1.5ms
+1= 2.33ms

I don’t know what I can use to create signals that fast

What about using some smaller micros to do it? Just buy a cheap 8bit micro that has a couple Analog to Digital pins and bit bang the signal out? Lighter than a CRIO or the old FRC control systems ever could be (plus uses less energy). You could, if you have one laying around, use a VEX brain to do it if you wanted.

So you just want a device to generate a PWM signal from a knob of some sort?

A servo tester would be a cheap way to do this, not sure if the packaging is very well suited to your purposes, but you could probably remove the POT on there and hook up your own that is the size and shape you want.

Don’t be so quick to shiver at the power draw of a potentiometer. Typically it will be on the order of milliwatts. If you are moving a human with your device, that is nothing.

I have to run or I’d be more explicit, but google “PWM

555”. A 555 is a standard chip that is useful for all sorts of timing operations. It is relatively straight forward to combine this with a few resistors/capacitors and your pot to make the PWM
signal you want.

Edit: The modern way to do this is what Andrew said. Cheapy microcontrollers have gotten so easy and cheap that there are fewer and fewer reasons to do things in analog. The 555 is the old fashioned tried’n’true.

A Vex starter kit will have compatible outputs—though you may have to splice wires to get the proper connector gender. That will let you program it (in a similar manner to the old IFI RCs—they’re based on the same architecture). You could probably hack an old joystick to connect to the analogue inputs on the RC, and use a simple variation on the default code to control it.

If you’re going to go to that much trouble, though, you could just as easily use the IFI RC you already have (documentation and default code are available here and here)—as long you can track down a copy of MPLAB IDE. Actually, if nobody remembers MPLAB, there is probably an easyC default code for it that will work with the trial version of easyC PRO from Intellitek.

Alternatively, most other R/C car receivers will generate the right signals, but you’ll have to control it with an appropriate R/C transmitter (e.g. with thumbsticks or a wheel).

If you’re dead-set on building your own system, consider the ST Micro STM8S-Discovery evaluation board. (Free samples available from ST Micro, or cheaply from major distributors.) You can configure it with one of the standard examples to generate PWMs…but I haven’t tested this myself, so I don’t know if there are any practical limitations. You’ll need to plan ahead, because the compilers (Cosmic, for instance) need registration codes that will take a business day or so to acquire (free, via e-mail; instructions on ST’s website). More information here.

We were planning to build this servo tester kit to help teach soldering. The bonus would be that we could control a motor without the need to have a full controller setup. Sometimes it would be helpful when prototyping to be able to run a motor to see if things work as expected. With a battery, circuit breaker, fuse panel and a speed controller, we hope that this circuit will allow us to control a motor for testing purposes. We have not actually used this yet, so I can’t guarantee that it will work.

If a servo tester works for you, let us know.

A way to get MPLAB IDE can be found here.

If all you’re doing is throttle control, you really don’t want a whole control system on there.

Random,
The 555 PWM generator that Erik mentioned is likely the easiest for you to build with parts you can obtain locally. Radio Shack or equivalent stores in your area should have all you need.

I agree with Al, like usual, on this one. A 555 timer will work just fine.

First link on Google seemed to look pretty good: http://www.dprg.org/tutorials/2005-11a/index.html

Try it out. This is a cheap and reliable solution. Probably way more reliable and safer than using a microcontroller.

Still the biggest reliability and safety problem will be the speed controller. Just with the Jaguar’s reputation for failing out of the blue, I would use the trusted Victor 884. Keep it clean and away from any metal shavings and don’t backfeed power into it by pushing your scooter around. You may also consider an 883 since it has a little more power handling than the 884, seeing that you’re just running a simple scooter.

Just thought of something for you as well. Motor current is proportional to motor load so make sure that the wheels on your cart and the transmission you use put the motor into a range on the motor curve it likes. I wish I had a dollar for every design I have seen that operated fine until you put it on the floor and tried to drive. The weight of the robot pushes down on the axles and without proper bearings that translates to very high motor current.

See the last post in THIS THREAD

Search before you post, you’d have had the answer 18 hours ago.

At my school, we have a box with a nob and PWM out. It lets us generate PWM. I don’t know what’s in the box, how it works, but it has come useful to us at times… Sorry I can’t help you any more… but something like that does exist…

Ill track it down one of these days and open it up to see what is inside (take some pics.)

…or you can look at the thread I referenced 2 posts above, which tells you what’s going to be inside that box of yours…

Just use a FRC Y Cable, it has male ends on both sides.

Can you post your vision code in a thread? I’ve looked all over the WPI site and can’t find it!

hey guys, I myself have been thinking about this for the last year on and off and with a bit of research found the answer.
Like someone from 111 i believe had posted, use a 555. They are exactly right.

After some testing and troubleshooting i got it down.
you need 1 555 that outputs a steady 50Hz signal. That should go to the trigger pin on a second 555. Use the second one to create the pulse 1-2ms with a pot (50-100K) and around a .2 uF cap.

I used a 556 IC, its got 2 555 built into it, this made it smaller and a bit simpler to wire.

Or… like someone said you could probably use a vex controller although iv heard there’s sometimes problems with that.

I guess if your not very comfortable around breadboards, go with the vex controller.

Or you could look into an Arduino. It’s a controller that’s pretty cheap (\$30 or so) and can be programmed through a USB cable. It has an IDE which uses a language which is basically C. It can also output PWM signals, so it could be useful for your case.