How to drive wheel on FPGA? - Page 1
Forum section: electronics / general

author: NobikaNg
author_rank: Newbie
timestamp: April 30, 2024, 10:17:59 am
content: hello all, I am a beginner of VHDL, and I would like to implement a obstacal detection car by using ZedBoard.Now, the biggesr problem that I encouter is drving the wheels and IP block design.Let me describe my project first:The car detect the obstacle by RCWL-1601​(a ultrasonic sensor) and the car will detemine to turn direction or go forward by checking whether the distance between the car and obstacle is larger than certain value. I would like to implement these by using ARM visit because I think C code should more easy to do this but I feel confused about the ip block desgin and don't know how to start it.Moreover, based on my knowledge from other embedded system, I need control the signal of the servo so that I can control the wheels, but I don't know how to do this in FPGA.Also, I am using ZedBoard which can only supply 3.3 V, so I would like to know is there any suitable servo that can be used?

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2024, 10:59:47 am
content: Hi and welcome to the forum.Why would you want to do this project on a ZedBoard that has way to much resources for this small task that is best run on a simple microcontroller.But to get you started with this on the ZedBoard you have to understand what the hardware offers you. Besides the FPGA it has a dual core ARM Cortex-A9 to run your code on. To use this core you will have to either dive into the manuals or search for projects that do this and use them as examples.Search for "linux on zynq 7020" to get loads of information. Or take a look at the resources onthis site.For driving a servo you can easily use a level converter to boost the control signal to 5V, but modern servos might even work with 3.3V levels on the signal line. All it needs is a PWM signal with a 10-30ms interval and a pulse width varying between 1 and 2 ms to control the position from 0 to 90 degrees. (May vary based on the servo used.)For learning VHDL or verilog for that matter I would advice to start with something different, like blinking LED's or make a counter on a display, and work your way up to more complex hardware.

author: NobikaNg
author_rank: Newbie
timestamp: May 01, 2024, 12:12:10 pm
content: Thank you for your reply. Actually, I am taking a VHDL course that requires me to define a topic and apply the FPGA knowledge I have learned in this course. I have also done experiments like controlling the blinking of LEDs. I initially chose the obstacle avoidance car as the topic because I had some knowledge of electronics and detectors from another embedded systems course, and I wanted to try to apply it in this course. However, I am finding this problem to be much more difficult than I imagined, but it should also be very interesting to complete.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 01, 2024, 12:29:44 pm
content: Quote from: NobikaNg on May 01, 2024, 12:12:10 pmIt certainly is. To obtain your goal try to compartmentalize it into smaller sections.First think of how you could do distance measurement in hardware. It depends on the ultrasound sensor if it is smart or dumb. With that I mean if it returns a digital distance value or just pulses of which the delay determine the distance. If it it the latter you can use a counter in your FPGA to time the space between the start pulse and the end pulse. You can then use this value in your C code running on the ARM core to base decisions on.Similar for the servo. You can have the ARM core write a value into a register setup in the FPGA and use that to send out the needed pulse for steering the servo.But for this you have to read up on how the Zynq device works with the processor side and the FPGA side.

author: NobikaNg
author_rank: Newbie
timestamp: May 01, 2024, 12:53:44 pm
content: My ultrasonic sensor is "dumb" sensor, but I have used this module before so I roughly know how to calculate the corresponding distance. The more troublesome problem now is that I am not very good at using Vivado to do IP block design. My course did not explain Vivado and Visit in detail, so I still don’t understand how to use them. I just simply understand IP block design as providing an interface for VHDL and C code to communicate.Can you suggest some good tutorial that can help me?

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 01, 2024, 01:15:02 pm
content: I have not used it much myself, but maybethis sitecan get you started.You are writing about IP block design, and that is somewhat irrelevant. IP stands for intellectual property and in FPGA world refers mostly to small parts that are created by the manufacturer to aid with making your own designs. Some are free and some you have to pay for when you want to use it. The things you want to do are techniques that are widely used, so best just to talk about making a design or in terms of Vivado a project.If you have the board and the software around to play with I would suggest to start with some simple example projects to get a feel for both the software and the board.Focus on the FPGA side first and try to have that do some simple things for you. Then try to incorporate one of the processors and have it interface with the FPGA. I know it is easy to write this, but I would have to dive into it and play with it too, to get something running, which also takes time. It is on my list for sure. Have some boards with Zynq 7010's on them.

author: nctnico
author_rank: Super Contributor
timestamp: May 05, 2024, 03:15:18 pm
content: Quote from: NobikaNg on May 01, 2024, 12:12:10 pmA problem like this is easier to solve through software. If you want to stay close to FPGA design, you could consider using the Picoblaze / Pacoblaze programmable statemachines. I have used these in the past with much succes.

author: NobikaNg
author_rank: Newbie
timestamp: May 11, 2024, 08:59:58 am
content: What is Picoblaze / Pacoblaze? I have no idea about these two, could you introduce how to use them?

author: nctnico
author_rank: Super Contributor
timestamp: May 11, 2024, 07:02:19 pm
content: Quote from: NobikaNg on May 11, 2024, 08:59:58 amThese are programmable statemachines. Just enter into Google and you'll find out more.First Google hit:https://bleyer.org/pacoblaze/

author: zapta
author_rank: Super Contributor
timestamp: June 17, 2024, 09:36:19 pm
content: Learning to program FPGA is a good goal. However, the ZedBoard seems to be over-complex for your goal.Have you considered a simpler board? I have been using successfully Upduino board and programming using APIO (an open source and easy to use Platformio like Verilog environment). The Upduino fits into a solderless breadboard so you can easily add 3.3v to 5v level shifter if needed for your servo.