Output an Analog Value

I know how to read an analog voltage, but I want to confiure the OX2 to output an analog voltage on one of its analog I/O pins. How can I do this?

Ok, I guess I assumed that it it could produce analog voltages on its output pins, but on closer inspection of its documentation it seems that it can only read analog voltages. If the OX2 can’t generate analog voltages, then I need to get it to send RC pulses. If anyone has any tips to get me started, that would be great.

Hello.

When you say RC pulses, do you mean standard RC hobby servo pulses (i.e. one pulse every 20 ms with a width between, say, 0.5 and 2.5 ms)? You could use the mega644’s hardware PWM outputs to generate pulses with minimal burden on the processor, or you could use one of the hardware timers to trigger interrupts in which you toggle digital outputs to generate the pulses you want. The easiest way might be to use loop delays between setting the state of the output pin, but doing it this way would occupy all of your processing time, so it won’t work if you need to be doing other things while sending out the pulses. There are a number of approaches of varying complexity, so it really comes down to what the pulses are, how accurate they need to be, and how comfortable you are interfacing with the mega644 timer hardware. I can provide you with some sample code if you can give me more information about what you’re trying to do.

- Ben

I’m trying to controll the AX3500 motor controller board by RoboteQ. I ultimately want to controll it using RS232 serial so I can have two way communication, but when I was trying to set that up I ended up breaking my OX2 (thread “OX2 Broken?” OX2 Broken?), so I’m a little gun shy to try that agian. My other option is to do the RC Pulses (1ms - 2ms). For right now I just used delays and an osciloscope to get the timing more precise, and I’ll try to set up the RS232 communicatoin later.

On another more annoying note, my new OX2 was working fine, and I was setting up some wires so that I could power both my OX2 and AX3500 off of the same battery. When I connected the OX2 again, it didn’t make a beep, and now I cannot get it to go into programming mode or to work at all (LEDs still come on when powered). Nothing shorted, no smoke, nothing was even connected to it but power. That’s two OX2’s that have broke on me without me knowing why. If I send them both in, can someone have a look at them?

Can you describe in more detail exactly what you did with the X2 between the time it last worked and the time you discovered it was no longer working (e.g. what was connected where)?

You can send them back for us to take a look at. Please mail them to our address as listed on our contact page. Please include a reference to this thread so we can identify the package, and make sure to specify the address you want the X2s shipped back to. If you bought the controllers from us and have your salesorder numbers (or the name of the person who purchased the products), please include that as well. Finally, can you make sure to mark the units so we can tell which of your threads applies to which device?

If we can figure out what went wrong, we’ll let you know.

- Ben

I had disconnected the OX2 power wires from the battery (wire leads left attached to the X2) and attached a simple wireing harness which allows for both boards (X2 and AX3500) to be connected to the same battery (12V). When I plugged the X2 into the wireing harness, the X2 flickered a bit until a solid connection was made with the battery. The X2 wasn’t working so I unplugged it and plugged it back in and noticed that it did not do its normal startup beep. I have been powering the X2 off of an external 5V regulator tied in through the IO pin headder (5V jumppers soldered from the factory) because the X2 is overheating with my 12V power supply.

You talk about doing things with the X2 power wires, but what was happening with wires used as your logic voltage supply? Were they connected the whole time? Was your regulator connected to the battery and your X2 as you were working on your battery connections?

- Ben

There is one set of wires from the battery to the X2. I split the wires and feed 12V into the power terminals (for the 12V motors) and supply the 5V regulator. This one set of wires was disconneced while I connected the second harness, so the logic power supply was not connected.

Can you measure the output of your voltage regulator and make sure it’s still 5V? The X2 has reverse-power protection, but you’re bypassing that, which makes me suspect that somehow your logic voltage either got connected backwards or exceeded the 5.5V limit. Given the symptoms you describe, it sounds like something bad had to have happened with the logic voltage. Can you think of anything that might be responsible?

- Ben

4.9 volts. Its a switching regulator.

I mailed both of my X2s a few days ago, I hope they come in soon. I referenced both threads respective to each OX2. Thank you for any help/suggestions you can provide.

We have received them, and I’ll be looking at them in the next few days.

- Ben

Have you been able to look at the OX2’s?

We’ve looked at the X2s and they seem to be in working order now. On one we just had to reflash the auxiliary mega168. On the other (unit 0149), we ended up replacing both MCUs. That unit now has an ATmega644P rather than just an ATmega644, but the only real difference is that you get a second UART on the 644P. They should ship out tomorrow.

If you experience problems like this again, where it seems like the microcontrollers are alive but just won’t program, try using the X2’s bootloader to reflash the mega168. You can find instructions for doing this on the Orangutan X2 product page (under the resources tab).

- Ben

Thank you and anyone else at Pololu who has helped out. I almost have a complete “first draft” of the project I am working on. I will be sure to post it and some pictures in the “Robotics Projects” section of this forum soon. I think you will be interested to see what the OX2 is being used for.

I look forward to hearing all about it!

- Ben