Home » Archive by category "Java" (Page 5)

Raspberry Pi Controlled Car : moving on

Hi folks,

after having assembled the car it was now time to move on.  The goal is to have a car that drives, not a car that collects dust. The last week I have been coding to get a nice set of functions to get the my car moving.  Not so long ago I already developed a piece of code to let a DC motor turn a wheel.  That experience I integrated in the current developments.  I had a strong limitation and that was the current I needed for my Raspberry Pi.  It was clear I needed a powerbank.  After some investigation I finally decided to order the XB101 Xtorm Power Bank Trip 9000.  I was a little worried about the 2.5 A current output from the powerbank knowing the Raspberry Pi needs maximum 2A.  Finally after a lot of googling came on a forum where somebody said that the Raspberry Pi only takes the amount current that it needs.  Another thing I was worried about was the 5V output.  I know the Raspberry Pi needs 5V but I was wondering what in case the powerbank was not able to give the full 5V and due to some loss (USB cable) only able to give 4.8V for example.  So I was looking for a powerbank with an output of 5.25V but didn’t find any.  Anyway I found some tests where the output was  also 5V and did not gave any issues for the Raspberry Pi.  After too much time of investigating and looking for information I finally ordered the powerbank yesterday evening.  And this morning it was already delivered.  My god what a great service.  I really hate running around in big stores looking for what I need.  I really prefer the internet.  It so much easier.  Now coming back on my developments.  I am now able to let the car move forward and backward by controlling 2 DC motors.  Let’s say  2-wheel drive.  Next step is making it able to turn.  There I will have to do some magic controlling the 2 DC motors to get this done.  Still thinking about the algorithm.  I am seeing a couple of possibilities but I have to test it first.

Before I forget.  I had to remove the cobbler and the breadboard because they were a real pain to get everything wired and placed on the car which was a big problem because the breadboard and cobbler took some place and were limiting me in my work.

About the source-code.  I will only publish once I have something that is presentable.  If you need the source about my current experiments earlier, please let me know and I can send it.

Jan

Raspberry Pi Controlled Car

Raspberry Pi Controlled Car

Continue reading »

Raspberry Pi Controlled Car : First Milestone

Hello folks,

I finally took the time to setup the car chassis which I got from China.  When I opened the package a while ago I immediately saw a bad surprise and that was the fact that I did not receive all correct pieces.  The 2 blades for the chassis are identical and that should not have been the case because first blade was especially for attaching the DC motors and the second for pieces on top of the chassis.  I had to use my creativity to get around that.  Another point were the pieces for attaching the DC motors to the blade which were not all the correct ones.  Anyway.  I managed to get the chassis set up.

As a first step I wanted to get one wheel turning forward and backward using Raspberry Pi, L298N (motor controller) and DC-motor.  See the result here : Raspberry Pi Controlled Car  Next step is getting the second front wheel to turn but than I will have to make sure they work together to get my car driving and turning in a controlled way.

Needless to say I used Java and Pi4J to do this.  I have not yet pushed the sources to github but I will as soon as I cleanup the test application.

 

Jan

 

Continue reading »

L298N

A while ago I talked about making a Raspberry Pi Controlled car.  Don’t worry.  I did not forget.  Actually, I started yesterday writing some code to get the DC motor running.  What I need to get this working from a functional point of view is a Motor Controller which is a L298N in this case and of course the Raspberry Pi whom who is the microcontroller.  I have put a wheel on the DC Motor to make more clear where I am going to.  I also need a powersupply (4 AA batteries in a parallel holder) connected to the Motor Controller.  After some time I finally got it to work.  Felt great to see the wheel turning in both directions.  All done with some simple instructions.  The most difficult thing was wiring everything up so to speak.  The programming effort was very limited, just a couple of lines to get this to work.  Very easy.  Just setting some pins low or high and done …  Far more easy than the I2C instructions.

Once I have cleaned up my code, I will put it on Github.

l298n

Jan

Continue reading »