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

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 »

Sensor HMC5883L

Finally found some time to finalize my developments for the HMC5883L sensor.  At first it looked like an easy mission but I encountered some issues during development and testing.  Trying to follow litterally the operational example gave me problems getting the right values.  Finally after some trial and error I found out the way to go.  The datasheet is not written for software developers.  But that is a remark I can make for all datasheets I encountered.  But anyway it gives a great feeling once you reach that breakthrough and get the right readings.  You can find the most important information at HMC5883L.  I found the information about calculating the heading at Calculating Heading.

When you look at the sensor you see an X and Y axis.  The angle calculated is the angle between the geographic north and the X axis shown on the sensor.  Well at least it is how I interprete it with the received readings.  I did not go into detail on the Z axis readings.

Jan

Continue reading »

Rasberry Pi Controlled Car

I still have some sensors from Adafruit I have to work on but I keep on thinking on my goal I mentioned in one of my posts.  I want to make a remote controlled (rc) car driving by Raspberry Pi and PI4J.  So finally I took my courage together and searched for that piece of hardware (car chassis) that will change my life.  I bought a car chassis (see picture) and controller to control the wheels on the car.  Bought 2 controllers just in case I would have the crazy idea to set up a 4 wheel  control on the car.  Not that I am putting pressure on myself. The componens come out of China, so it takes a while before they will be here in Belgium.  When looking for the components it surprised me that those pieces cost a lot less than in other parts of the world and even more crazy the fact that there are no shipping costs.  Found a site where the transport costs were higher than the hardware itself.  Amazing.  Disadvantage is the fact that it will take a while before they will arrive.  I have time but really looking forward to start developing, solding and putting everything together.

To be continued …

New 4WD Robot Smart Car Kits Chassis w/ Mobile Platform 4 Wheels Dual H Bridge DC Stepper Motor Drive Controller Board Module Arduino L298N HG

Jan

Continue reading »