• AVR Freaks

Hot!PIC32 based robot

Author
dj_quaver
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2019/10/04 01:34:26
  • Location: 0
  • Status: offline
2019/10/12 03:42:23 (permalink)
0

PIC32 based robot

Hello everyone!
I have to do a school project with the ChipKit Uno32, which has a PIC32MX320F128H microcontroller, and its I/O shield. We want to take this opportunity to make a "real hardware" project instead of a game on the screen.
 
We want to start by a basic obstacle avoiding robot and upgrade its functionalities in time.
 
We were thinking about following a model of obstacle avoiding robot on circuit digest using PIC16F877A. Is there anything to be particularly careful about, since  it is not the same microcontroller?
 
I also bought a kit on internet which has those items (it seemed simpler than picking stuff individually): one UNO R3, a servo SG90,  and one L298N. Will the L298N motor driver work with the PIC32?

 
I also bought individually collision sensors : breadbords and cables. Will the collision sensors work with the PIC32?
 
Thank you a lot for any response!
 
post edited by dj_quaver - 2019/10/12 03:44:10
#1

4 Replies Related Threads

    maxruben
    Super Member
    • Total Posts : 3367
    • Reward points : 0
    • Joined: 2011/02/22 03:35:11
    • Location: Sweden
    • Status: offline
    Re: PIC32 based robot 2019/10/12 04:47:38 (permalink)
    5 (1)
    Although the L298 is a bit dated it will work fine with a PIC32. Note that the L298 has 5 V TTL levels for its control inputs so you have to make sure that the outputs of the PIC32 is ok. As long s the PIC32 is working at 3.3V it should be ok. I have successfully used the L298 module  to control a DC motor from a module with a 3.3V ESP8266 chip without level converters for the motor control signals to the L298.
     
    Note that the L298 needs an external 5V for its drive circuit. The module has an internal 5V linear regulator which can be enabled with a jumper so no external 5V is needed. Note that if your motor voltage is higher than around 12V or that you need 5V from the L298 board for something else, the internal linear regulator can get quite hot. I lowered the input voltage with 2 serial connected diodes (two 1N4004 in series) directly on the jumper which worked quite well.
     
    The collision detection module you have linked to is powered with 5V. It doesn't say what the output signal is but you may have to use a 5 V tolerant input for this on the PIC32. Otherwise you can use a level shift circuit in-between.
     
    Good luck and have fun / Ruben
    #2
    dj_quaver
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/10/04 01:34:26
    • Location: 0
    • Status: offline
    Re: PIC32 based robot 2019/10/12 07:12:07 (permalink)
    0
    I think the motors are 5V. I can't find them in the package description, but all kits seem to ship the exact same DC motors. If you write in your favvo search motor "DIY L298N 2WD Ultrasonic Smart Tracking Moteur Robot Car Kit", you should see the ones I mean, they are yellow.
     
    Also, do you think I should use three sensors (one US and two infrared) or one US sensor on a servo? Is it hard to get the signal at the same time if I use infrared sensors and US sensors?
    Which is more intuitive? I never did electronics before so I really want the simplest.
    #3
    maxruben
    Super Member
    • Total Posts : 3367
    • Reward points : 0
    • Joined: 2011/02/22 03:35:11
    • Location: Sweden
    • Status: offline
    Re: PIC32 based robot 2019/10/13 03:34:46 (permalink)
    5 (1)
    dj_quaver
    I think the motors are 5V. I can't find them in the package description, but all kits seem to ship the exact same DC motors. If you write in your favvo search motor "DIY L298N 2WD Ultrasonic Smart Tracking Moteur Robot Car Kit", you should see the ones I mean, they are yellow.

    It looks like it is the same motor I used and I think the rated voltage is 6 V but the L298 has voltage drop of a couple of volts (which is why it needs a pretty large heat sink). Also it looks like the kit comes with a battery holder for 6 AA batteries which would make the input voltage about 9 V with fresh batteries. 
     
    I power my little gadget with around 12 V which gives a decent speed on the motor. I have not done a robot but just a little IoT test device that I can control with a HTTP dash board over WiFi with a nodemcu and a MQTT broker on a Node.js server. With the dashboard I can control the motor PWM and direction and the device measures the RPM which is reported back and shown on the dashboard.
    dj_quaver 
    Also, do you think I should use three sensors (one US and two infrared) or one US sensor on a servo? Is it hard to get the signal at the same time if I use infrared sensors and US sensors?
    Which is more intuitive? I never did electronics before so I really want the simplest.

    In order to do several things simultaneously you can either use non-blocking state machines or an RTOS. Measuring distance with US or infrared sensors can be done with interrupts so it won't disturb the flow in the main code.
     
    /Ruben
    #4
    dj_quaver
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/10/04 01:34:26
    • Location: 0
    • Status: offline
    Re: PIC32 based robot 2019/10/13 04:32:04 (permalink)
    0
    Hi Ruben!
     
    maxruben
    dj_quaver
    I think the motors are 5V. I can't find them in the package description, but all kits seem to ship the exact same DC motors. If you write in your favvo search motor "DIY L298N 2WD Ultrasonic Smart Tracking Moteur Robot Car Kit", you should see the ones I mean, they are yellow.

    It looks like it is the same motor I used and I think the rated voltage is 6 V but the L298 has voltage drop of a couple of volts (which is why it needs a pretty large heat sink). Also it looks like the kit comes with a battery holder for 6 AA batteries which would make the input voltage about 9 V with fresh batteries. 

     
    I guess I can change it for a ONE 9V battery :)
     
    I got specs for the motors from the seller.
    - Size: 70.15mm x 22.33mm x 18.53mm
    - Rated voltage: DC 5V
    - No-load speed 200rpm±: 10%
    - Gear ratio: 1 to 48
    maxruben
    dj_quaver 
    Also, do you think I should use three sensors (one US and two infrared) or one US sensor on a servo? Is it hard to get the signal at the same time if I use infrared sensors and US sensors?
    Which is more intuitive? I never did electronics before so I really want the simplest.

    In order to do several things simultaneously you can either use non-blocking state machines or an RTOS. Measuring distance with US or infrared sensors can be done with interrupts so it won't disturb the flow in the main code.
    /Ruben

    So you mean that I can make if-statement to check which flags are up simultaneously (8 if-statement according to my truth table) and send instructions accordingly?
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5