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

Developments TCS34725 finished

I created a new release 1.2 and pushed to Github.  I finished the development and troubleshooting for the use of TCS34725.  After posting my findings on the Adafruit Forum I understood that my readings in my application were correct.  A little python script proved this because the results there were the same.  As a conclusion I can say that I am kinda disappointed in the sensor.  The sensor is apparently very sensitive for surrounding light which impacts the readings.  I just thought that I could put an object of some color on the sensor and get rgb values who were close to the actual color of that object but it is not that easy.  Read the forum for more information.  I have finalized the development.  Feel free to comment.

As with the other sensor, I used PI4J, IntelliJ and Java 1.7 of course.  The application is running on Raspbery Pi B+.

 

Jan

Continue reading »

Sensor TCS34725

Currently working with the Sensor TCS34725 (Color light-to-digital converter with ir filter.  Promising when you look at the description of the sensor.  But already when doing early tests I did not get the right rgb readings.  I also used a simple Python program to get the RGB readings but also there the output is similar.  Like with the other development I did earlier in this blog, I also use PI4J.  Now I am checking my source code and verify with the datasheet for the sensor to find out if I am missing something but since the Python program has similar results I have some doubts I do something wrong.  In the meanwhile I also had contact with Adafruit support around this issue but my questions are still unanswered although I got reaction from them.  See thread on  https://forums.adafruit.com/viewtopic.php?f=8&t=67795  Feel free to make comments too if you have any ideas.  I am open for them.  I hope I can get the sensor give me the results I expect or have an explanation why I have not.  Shoot if you have an idea.

See TCS34725 for more information on the sensor.

Jan

Continue reading »

First Example release ready

My first developments are ready. In short I created a java application that has to be installed on the Raspberry Pi which will read temperature and pressure from an Adafruit sensor (mpl1115a2) and showing reading on a small 16×2 LCD screen (Adafruit). As said in my previous post, I only used java technology and Pi4J. But in fact this is not 100% correct because behind the scenes, Pi4J is using a library called Wiring Pi. The wiring was simple once you know how to connect the pins to the LCD screen.

  • First read about the installation steps for using and installing Pi4J
  • To connect the LCD to the RP the following site was very useful : http://wiringpi.com/dev-lib/lcd-library/
  • For the use of the barometric sensor (mpl115a2) I would like to refer to the site : Adafruit mpl115a2
  • Information on LCD shield kit w/ 16×2 Character Display
    • I did not use the shield.  I did not manage to get it working using Java and the Pi4J api.  I am sure it is possible but the complexity lays in the fact that the shield has an I2C expander and that made me give up in a first stage.  I did get it working compiling one of the C Examples from the Wiring Pi site but my goal was to get it working via Java.  I know, I am stubborn.

Components used

  • breadboard (big enough)
  • Raspberry Pi B+
  • ADS1115
  • mpl115a2
  • LCD shield kit w/ 16×2 Character Display
  • lots of wires

Tools used :

  • Intellij
  • Git
  • SourceTree

Important notice:

For the RP to be able to read from the sensor, an analog to digital (ADC) converter is necessary since the sensor only returns analog information.  I have chosen for the I2C protocol so I needed an ADC which supported this protocol.  For this project I used the ADS1115.  It took me a while to understand but that was more related to the fact that I have no electronics background.  But anyway, Google showed me the way to some interesting sites to get my knowledge in this context up to scale.

Lessons learned

  • before using the sensor and lcd, make sure you have done all the soldering necessary.  I made the mistake of not doing this in the beginning causing malfunction of the LCD but after soldering, all issues disappeared.
  • Read the datasheets carefully.
  • Doublecheck the wirings
  • make sure you have a big enough breadboard

The source code is available on Github: https://github.com/jbyle/PI4JDevelopment.git

Comments of any kind are well appreciated, also source improvements.

IMG_0986

Continue reading »