Posts

Arduino Interrupts Suck, FPGA to the Rescue

Image
It should be easy enough to read PWM signals using Arduino, right? At least that's what I thought, but I found that there's all sorts of gotchas and maybe even bugs in the Arduino libraries. I eventually gave up and built a custom FPGA to do the job. Overview of PWM PWM, or pulse width modulation, is just a single wire that alternates (pulses) between high and low voltage. It's up to the attached devices to decide how those highs and lows are interpreted. Variables include the pulse frequency and how long the signal is held high or low. Some devices care about the duty cycle, which is just the percent of time that the signal is high. Others, like an RPM sensor  reader, only care about the frequency of pulses. Hobby servos care about the pulse width, or the time duration that the signal is high. For hobby servos, the pulse width varies between 1 and 2 milliseconds +/- a few hundred microseconds depending on the servo. The servo translates the pulse width to rotational angles...

Making an Enclosure

Image
One of the more difficult things I've faced so far in this project is finding a good enclosure. I need something that will fit my electronics and will also fit in my RC car. I also want something that's fairly water resistant since it tends to rain a lot around where I live near Seattle. I tried food containers (the round corners posed challenges), a Savox servo plastic box (the lid won't stay closed), and some project boxes that I got on Amazon (they're pretty heavy and tend to be too tall for what I need). A few of the enclosures that I tried. Nothing was working, so I looked into making my own. Blast From My Past Long ago I thought I wanted to be a mechanical engineer (I still think it would be a ton of fun). After high school, I worked in a metal fabrication shop at this place  for a year before starting college, and again a few summers between semesters. Working there, I did everything from assembling hoppers and huge X-ray cabinets (used to inspect airplane parts)...

Detecting wheel slip using the Traxxas RPM Telemetry Sensor

I want my autonomous RC car to be able to know when the wheels are slipping . This will be prerequisite information to detect and predict conditions such as understeer, oversteer, and wheel spin. I believe this will be crucial to maintain control of the car during high speed maneuvers. Wheel Slip Lateral wheel slip is is the angle between the direction the wheel is moving and the direction it is pointing. My plan for this is to use the car's velocity vector as the direction it is moving and to use an onboard magnetometer to determine the direction that the car is pointing. For the front wheels, I'll have to factor in the steering angle as an offset to the wheel's heading, which I can approximate with the steering servo's position. I'm not yet to that stage of the project, so expect more on this later. Longitudinal wheel slip is the percentage of the difference between the surface speed of the wheel compared to the speed between axle and road surface. Positive longit...

Introduction

Image
A few weeks ago I had a crazy idea to make an autonomous RC car. I've been working on it for a while, so I figured I should start writing down my experience. I'll start with this general overview of what I've done so far, then provide updates or deep dives in later posts. Goals Here's what I'm trying to achieve: The car navigates itself around a course set by waypoints. It has some way of knowing its location, I have some way of setting the waypoints, and I have some way of telling it to start and stop. The car should drive around the course as fast as possible. It should be able to handle and anticipate understeer, oversteer, and wheel slip. Obstacles are not a concern. I want to focus mainly on control of the car, not on the dog that runs out in front of the car. For that, I will need a way to take over manual control of the car at any instant. I do not want to rely on machine learning or computer vision for the primary means of control. I want to build as many of...