SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By SOI_Sentinel
Though I'd share :)

This very prelim design is somewhat similar to what I see you doing with your KidBot system


This is a low power, low range bidirection system.

The Laipac provides a bidirection connection to a user's controller (PC, or my eventual handheld R/C control box). I plan to eventually integrate the Nordic chip and a power booster directly onto the PCB eventually. It's currently planned to run on SPI, but a synchronous USART will probably replace it (and the RS232 interface) and free up the MSSP for serial memory or other serial components (I2C possibly).

The 18F458 has plenty of horsepower to do most of the stuff I want. The motor controller ECCP module lets me either integrate a bidirectional motor controller onboard in PWM hardware (say, for an R/C car) or drive two single direction burshed motors (Twin engine airplane). The standard CCP is still available for other uses (digital motor speed feedback, another motor controller, etc). The free analog block gives me up to 8 analog sensors, or with lots of differential sensor amps and a ±5V switching power supply, a full 6DOF IMU interface. That may be too much computation time, however. Port B can be dedicated to R/C servo driving, although I have 2 of the lines set up for a CAN bus. The remaining I/O may be useful for hardware switches, more R/C servos, etc.

The CAN bus is the expansion line. 1Mb/s and tough enough for automotive work sounds good for me. I'm thinking it'd be good for other CANoPIC (CAN on PIC) based modules, such as a dsPIC brushless controller, another PIC based servo board, a sensor board, autonomous planning board, etc. Enough bandwidth to pass stuff along, even critical stuff like motor and servo controls.

My original plans was to have fairly dedicated boards (motor board, sensor board, communications board, etc), then I realized how wasteful of hardware that might be (still working on this one), so I'm trying to integrate at least enough to get a basic R/C system up and running. I was reading about how 72MHz systems often get glitches, and I though this typ of design might bypass a lot of that, using CAN to send commands to outboard servos instead of PPM. The 18F458 was chosen as it's readily available, has lots of onboard options, and is supported by IC-Prog so it's not limited to MPLAB or ICD2 users.

Now, I'm planning on using either the 2.4GHz link or a CAN based bootloader to allow for remote programming (possibly CAN only), and probably on the fly software fine tuning and configuration. For instance, being able to program a configuration where certain ports are used for a 1Hz strobe trigger instead of R/C, or using the analog block for R/C signals instead of sensors, etc. Also servo control or fine tuning might work too.

I've also been considering using a PIC and modifying a standard servo to turn it into a serial servo instead of a PPM (servo modified for 360 degree rotation, PIC getting in serial commands and using the pot and analog to determine position and speed, basically a low cost way to make your own digital servo), but that's another project. As is building little R/C cars with power amps and running a Nordic based mesh network across the flying field to provide a distributed transmission system to a flying R/C aircraft based on this design.


Reviewing the 458's data sheet, I'll probably end up losing the standard PWM to use it as a timer for interrupt driven R/C servo drivers. I'm also considering more seriously a move of the Laipac to the USART. Hmmm... or I could move to an RS-485 based network and claim back the CAN bus... decisions decisions.
User avatar
By sparky

Designs are always thrifty on paper - good luck with the implementation ;)

By SOI_Sentinel
A little update:

The design's moving to an integrated Zigbee transciever. And 2-3 boards. I figured that a single board (especially with servos and a motor driver onboard) would be too much noise for the RF end, and it was getting a little crazy trying to interface 5V RC, motor, and CAN with a 3.3V RF. CAN will work at 3.3V logic drivers, thankfully :)

So, currently we have a Zigbee-CAN bridge, a CAN motor controller (30A max, 10A unheatsinked, thank you ST Micro), and a CAN servo controller. The ZIGCAN bridge is going to keep it's servo hookups for simple I/O and analog dongle headers.

And can we move this over to Projects?
By SOI_Sentinel
Progressing forward on the hardware and software.

Currently plan to use a PIC 18F4680. Besides the CAN and Zigbee chip, I'm also going to have:
-exposed UART
-trigger button (may be for a SW reset, or to enter field programming mode)
-8 GPIO, 4 with interrupt on change, 4 with ADC inputs as alternate, setup will be as standard R/C servo (signal center).
-One additional 6 pin SPI header for those 6 pin serial modules I see floating about.

Of note: All I/O are in use. The current design will not have the Zigbee chip's integrated 1.8V voltage regulator enable (VREG_EN) pin connected to I/O by default, but I will leave enough space to jumper it if need be. I am not connecting the RESET pin as that can be triggered by the SPI connection. If I decide to go with, say, a canned oscillator instead of a crystal, then I'll connect the VREG_EN. All depends on costs.

Now, for a question to everyone: I'd like to run the PIC and the rest of the system at 5V, but the Chipcon (along with all other ZB chips so far) runs exclusively at 3.3V. Now, I need 8 unidirectional lines to cross the voltage boundary (5 to the PIC, 3 away from), three of which need to be able to handle 10MHz SPI speeds (one in, two out). There might be another high speed input as I haven't determined the click rate of the SPD line yet.

I've looked at level converters and found them somewhat wanting, and I just seem to be running up dry in the books I have and with Google today. Any suggestions? I'd love to find some very low cost high speed opto-isolators in a SMT package, but all I've found so far are for high power designs, not fast switching, and cost a bit more than I'd want to pay,

I'm trying to avoid either running the PIC at 20MHz and 3.3V (although that is a possibility) or switching to one of the new high pin count J series and adding a 2515 SPI CAN engine. I'd still need a 5V rail onboard for the CAN transciever chip.
By Pete-O
I'll throw in my 2 cents...

I recently did a project that involved CAN, a PIC and nRF2401 chips. Because of the number of lines involved between the PIC and the RF (and one of them bidirectional), I decided to do the level swap between the PIC and the CAN driver. I used an open drain (previously said "gate", needed more coffee) buffer of some kind, can't remember what exactly. What I found was that the buffer introduced some kind of delay between the PIC and the CAN driver that prevented operation very effectively. In the end I went 5V to 3.3V without any shift and 3.3V to 5V with a 2N3906 and a 4.7K resistor. A little icky, but it worked in a pinch.

BTW, I fly RC gliders so I'm very curious how this is gonna pan out.

Last edited by Pete-O on Thu May 12, 2005 5:38 am, edited 1 time in total.
By SOI_Sentinel
Thanks Pete. I'm considering just running the PIC at 20MHz instead of 40 like I wanted to and going all 3.3V for the first incarnation of the board. My current board actually has a 18F2680 onboard and uses all 23 I/O, which actually might be TOO messy a setup for this after considering all the headers and SPI and trying to follow good PCB layout practices on a double sided board. So, I'm going to try it with my (oops!) typo above and do either a QFN or a TQFP 18F4680, as those chips are also smaller than the SOIC 2680.

One thing: as long as I run the Zigbee chip in buffered mode, all lines are unidirectional, so no problem there. I have seen the problems with timing in my experiments (I looked at level translators from TI), especially when recieving data as those have the entire bus going one way, and other timing issues.

Back to beating my head through my monitor (aka learning EAGLE)

P.S. I'm obviously not liking the standard CANBUS hookups of DB-9 hoods. I'm thinking 4 wire phone lines with each twisted pair having one signal and one ground. Yes, plugs included. Any other suggestions?