|
|
|
DumHed
Experienced Roboteer
Joined: 29 Jun 2004
Posts: 1219
Location: Sydney
|
ok this serial problem is really strange!!
Basically I'm sending out a serial data stream from the TX that has an address byte followed by channel data for each of the three channels, then the RX is using the SERIN command with the filter containing the address byte value for the channel it needs to decode.
The idea is that SERIN waits for the address byte, then grabs the next byte and saves that in a variable for the channel data.
TX:
code:
SEROUT 0,N2400,(1,chan1,2,chan2,3,chan3)
chan1, chan2, chan3 are obviously the channel data values, and the 1, 2, 3 are address values.
RX:
code:
SERIN data_in,N2400,(addr),stream
data_in is the input pin, addr is the address value, stream is the channel data.
Now, one would assume that this is a pretty simple thing (apart from being trapped in the SERIN routine if there's no valid data), but my input data is offset by about 20 (I think it's actually 17) on channel one.
If I change the address to channel 2 I end up with the data being offset by ~5 instead of ~20!
I've tried making the address bytes values of 11, 12, and 13 instead, slowed it down to 1200 baud, split up the transmit routine and paused between each byte, tried inverted logic, and pretty much anything I can think of, but it gives the exact same effect!
This afternoon I replaced the RF modules with a bit of wire, but it still seems to have the data offset by a "few".
So, I think maybe the serial input routines used in the PICaxe are a bit buggy, or there are some strange timing issues.
I'll see if I can get it on a good scope at work tomorrow and manually see what the data looks like at each end.
Chances are the PICaxe serial handling and clock accuracy are just not good enough, coupled with the slight timing fluctuations induced by the RF link.
The really weird thing though is that the address bytes are always received perfectly, and I don't get any anomalies in the data, just a constant offset from the correct value.
Thinking about the way serial bytes are sent, for an offset of 17 I must be dropping the first and fifth bits out of the byte!
This seems like a strange thing to be happening, but maybe it's possible.
Another weird thing is that the received values are still within my exact range (100-200). So even when it's offset by 17 (mid point of 133 instead of 150) I get a minimum of 100, and a maximum of 183.
A value of 100 means it's getting bits 7, 6, and 3
183 needs bits 8, 6, 5, 3, 2, 1
It doesn't make any sense!
I think I'll go pack to transmitting a pulse width _________________
The Engine Whisperer
- fixer of things
|
Mon Feb 06, 2006 10:09 pm |
|
|
|
|
|
|
DumHed
Experienced Roboteer
Joined: 29 Jun 2004
Posts: 1219
Location: Sydney
|
hehehe, well that's kind of funny really - kind of solves its own problem if you're driving servo outputs
Brett: all this is being looked at in a simple serial echo routine. I haven't had this version driving any sort of outputs or doing any other processing yet.
I had the serial link controller working before, but it had the values offset by 27, and I was just adding 27 to fix it.
With this version I can't just add to it because it's still staying within my channel value limits, so I'd never be able to get full reverse.
In the end, I think there are timing issues that will prevent this from being a reliable solution, so for now I will go to the pulse train system.
The idea of this is to make something that's reliable, and based on cheap and easy stuff to get.
I'm sure it'd work well using more expensive serial RF modules, PICs running on proper crystal oscillators and using hardware UARTs, but I like the idea of making it work with the simple stuff _________________
The Engine Whisperer
- fixer of things
|
Tue Feb 07, 2006 7:48 am |
|
|
|
|
DumHed
Experienced Roboteer
Joined: 29 Jun 2004
Posts: 1219
Location: Sydney
|
since both would be transmitting at the same time I think the result would be no one being able to receive anything cos the data will be corrupted.
I think serial data can be done, bit the PICaxe is maybe not the chip for it.
Ajax: I'm sure some tweaking of the clock would help, but in the end I need these things to have a fair bit of "give" to work reliably, and they'll be exposed to all kinds of temperature changes, electrical noise, and multiple chips will be used.
I could do some sort of auto calibrate program (serial echo and tweak the clock up and down till it gets the right values) but I think it's still going to be too touchy.
In other news, my pulse train style system is working pretty nicely, so now I just need to get it doing PWM (basically mean un commenting a bunch of stuff) and do some range testing
Interestingly, when using the RF link all pulses end up about 50us longer than they do when using a short cable.
That's probably part of the serial issue, but it's a lot easier to correct in this setup.
Also, feel free to also use 433MHz.
I'll be looking into other frequencies once I have it working.
I'm thinking of modifying a 2.4GHz video transmitter / receiver set to see if I can send pulses or data over that.
They tend to have selectable channels too. _________________
The Engine Whisperer
- fixer of things
|
Tue Feb 07, 2006 9:05 am |
|
|
|
|
|
DumHed
Experienced Roboteer
Joined: 29 Jun 2004
Posts: 1219
Location: Sydney
|
I got basically all my software working, so today I made up PCBs for a bunch of stuff.
Transmitter board:
This fits inside a cheap 2 channel radio, using the original board mounts, control sticks, switches, and battery holder.
One of the old channel reverse switches is now used to enable mixing to drive tank control.
There are connections for two different types of RF module (the cheap Jaycar one, and a super high quality FM 433MHz module I had at work)
Receiver board:
There's one of these needed per channel, and they connect together to take the same pulse stream from the RF module.
I've designed this so the same board can be used for my radio system, or for traditional servo inputs, with a quick software reload.
I have some ideas for these that will allow them to do mixing, or have gyro inputs (from a $10 gyro module) so a complete controller for two motor channels will require two of these boards and two of the power control boards.
RF module board:
I made up a small PCB to hold one of the FM RF modules I'm using, to make it easier to connect to.
The Jaycar modules connect directly to the receiver boards very easily.
PWM and relay reverse board:
This is an opto isolated board containing 4 MOSFETS, 3 for PWM control of the motor, and 1 to switch a couple of horn relays for reversing.
I could probably go for a smaller transistor for the relay control, but this way means less different parts are used, and it'll handle any size relay(s).
I'll also make a full MOSFET H-bridge board with the same interface once I have a better look at the driver chip options.
Mixer:
I made a mixer program for the PICaxe so I figured a super tiny mixer module could be handy for some people.
It's about as small as possible, with two inputs, two outputs, the PICaxe, and a bypass capacitor.
I haven't tested this yet, but there's no reason why it won't work
So, tomorrow I'll make up the rest of the boards and test them out.
I'm looking forward to having a completely custom control system in my robots!
I have a few more ideas to try out too, with some gyro / accelerometer stuff, and I want to do a fully mixed two channel relay controller using one PICaxe, to work from my transmitter - for possible use in other bots like Woktronix. _________________
The Engine Whisperer
- fixer of things
|
Wed Feb 08, 2006 11:11 pm |
|
|
|