After a bit more thought, there is now a new set of pin assignments for the Primus micromouse, along with a corresponding schematic.The problem with Primus was that it is not possible to generate two independant pulse trains from the PWM generators. All the PWM channels have to share a common time base.The Output Compare peripherals on the dsPIC30F4011 can generate up to two independant pulse trains in hardware but one of the time bases must come from Timer 2 which is needed for counting steps sent to the motors. One of the fundamental design decisions on Primus is to drive the two steppers at high speeds without any interrupt service routine soaking up processor cycles.It seems that one motor will have to be driven from an OC channel and the other from a PWM channel.The PWM channel is fairly straightforward, we just set the duty cycle to something appropriate, like 50%, and change the frame rate to get a square wave at some arbitrary frequency. steps are always made on the leading edge of the pulse so the actual duty cycle is not too important as long as the pulse satisfies the minimum leng specified for the driver chip. This is 2us so we have plenty of scope.For the other motor, one of the OC channels (OC1) will take its time base from the currnetly unused Timer 3. OC1 will be configured to generate short pulses at the start of each cycle. Again, only the leading edge is significant so we just need to make sure that the pulses are at least 2us long.This is not as elegant as I had hoped. the limitations of a 40 pin device start to bite here. Other devices in the family with more pins (but surface mount) give access to a couple more counter inputs and would make the problem a lot more simple. Just to add an extra layer of complication, I amtrying to arrange the pin functions so that conversion to a DC motor driven mouse will be easier. It might have turned out simpler if I had not bothered!The previously published schematics and pin functions have been updated and are available here:

Mainboard Schematics

Pin function list

This Post Has 6 Comments

  1. Barry Grubb

    Hi Pete,
    I see from the schematics that you are powering the Nokia LCD fron Vcc at 5V. all of the references I have seen suggest 3.3V. Have you experience any problems at 5V or am i missing somthing?

  2. peteh

    I looked at the datasheet for the Philips chip that drives the display and it indicated that it would be safe to run at up to 7 Volts.

    Since the first display I tried was just an experiment from a broken phone, I figured I had nothing to lose.

    It works a treat and I have had no trouble with the half-dozen I have used so far.

  3. Alan

    I know this is a few months old.

    What about a dsPIC33? I’m using a 28 pin part, you’ll probably need more pins. Maybe an adapter? It does support two encoders, and will run two PWMs. Is this your new board?

    Alan KM6VV

  4. peteh

    At the time, only the dsPIC30 was available in a DIP package and so could be built on perfboard and the like.

    My next mouse will use the newer dsPICs probably.

  5. faiz

    I have few queries regarding u r sensor schematics.First thing is that of my understanding of u r ckt, plz tell me is it right r not . You are using a microcontroller to pulse the emitters via a uln2803 so that you send more current to the emitters and from the recivers you are reading the analog value??. My second question is what are the fwd_led, diag_led,side_led in the sensor ckt which you have given to another ic(ic number not given)I guess its uln2003. My last question is I usually get adc value in the range of 12-20 only how much are you getting .

    thank you.

  6. peteh

    Those signals do not go to an IC. The part labelled ‘sensors’ is a pin header that the sensor board connects to. I do not recall what the sensor readings come out at I am afraid.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.