Jerome Bernard Blog

Anything mostly related to Programming, Arduino and Photography.

Introducing Grapi: Generated REST API

| Comments

I’m pleased to officially announce Grapi today.

Grapi (Generated REST API) is a Java source code generator based on APT (Javac plugin).

As explained on GitHub page, Grapi analyzes your JAX-RS source code and generate some code in order to expose your JAX-RS resources through Netty.

Basically Grapi generates some optimized Java code for ease of use of JAX-RS resources through Netty.

There is no runtime dependency on any JAX-RS provider (actually only a small one on Jersey UriTemplate class which will be removed later on) and Grapi is not a JAX-RS provider.

Grapi avoids the introspection crap and generates Java source code which will work according to the JAX-RS resources. When some JAX-RS features aren’t used, some Java code is dropped from the generated source code in order to both reduce complexity of the generated source code and improve the performance and maintenance of code.

Additionally, Grapi can generate a Dagger module in order to simplify even more the use of the generated code and also use Metrics in order to measure various timings about your JAX-RS resources.

I hope this project will prove as useful to others as it does on some other projects of my own.

How to Connect Adafruit NFC Shield to a Mac, via Libnfc

| Comments

Intro

I’ve recently been experimenting with NFC projects.

The first test was done using an Adafruit NFC Shield for Arduino. I was able to get my code working with the default setup (that is using the shield with an Arduino).

However, as I need to test Peer-to-Peer mode (P2P for short) in NFC, I quickly found out that this is not something easy to do with an Arduino.

While the PN532 chip on the shield do have such capability, the Arduino libraries are far from being mature and don’t support this, yet :–(

So, I decided, I should first try out libnfc and if it works, I could replace my Arduino with a Raspberry Pi.

Arduino, BeagleBone and XBees - Oh My!

| Comments

Sorry, I couldn’t find a better blog post title :–(

This blog post is actually something like a mix of my two previous blog posts.

I’ve enhanced the previous RGB Led Strip project controlled by an Arduino in order to send temperature readings via XBee to another XBee node.

The reason why I want to do this is that I want to control some RGB Led Strips in my home with various intelligent modes (like the example one based on temperature). But as I need some sensors for this intelligence, I thought this was an interesting opportunity for building some Home Automation right there and gather sensors data from those lighting nodes to a gateway one which would keep all the data in a central place and provide a way to interact with all the various nodes.

RGB Led Strip Controlled by an Arduino

| Comments

I bought a few weeks ago some quite cheap 5 meters RGB LED strips (60 LEDs per meter) on eBay. My intent is to drive them with a custom Arduino receiving commands over some XBees.

I was in need of MOSFETs in order to drive the 3 RGB channels, and again found some cheap ones on eBay I received a few days ago.

Today was a good opportunity for doing some basic tests. My first step was to control the color of the RGB LED Strip with the help of the MOSFETs and an Arduino.

Before your read the rest of this blog post, you should read Adafruit tutorial on RGB LED Strips and Bildr tutorial on MOSFETs.

I mostly did what Adafruit tutorial explains, except I added 10kΩ resistors, between each control/gate pins and ground (so 3 resistors for a RGB strip), in order to force the signal to LOW until the Arduino kicks in!

BeagleBone: Serial Ports and XBees

| Comments

I bought a few months ago a BeagleBone. I wanted to experiment using it those last days in order to get some XBee data from my previous Stalker project.

Having a bit of experience with Arduino and Stalker did not help much. The BeagleBone is a complete embedded Linux system and you can’t expect to use it as easily as an Arduino (although the NodeJS demo is really cool — programming via the web browser instead of uploading programs).

Simple things like using the UART (the BeagleBone has 6 UARTs, but only 4 of them available for your programs) did turn out to be a PITA. Hopefully I could find some interesting blog posts explaining how to set them up.

So in this blog post, I will try to explain how to set up properly UART1 and UART2, and then how to connect an XBee to UART2 (there is way more information available on the Internet on how to use UART1, hence my choice to illustrate UART2 usage) in order to receive the data sent by my Stalker.

Stalker: Reporting Temperature and Battery Usage Over XBee

| Comments

Since my last blog post on the Stalker, I’ve been able to get an Arduino Sketch to both log temperature data and battery usage every minute on the SD-card, but also to send this information as XBee Packets in order to display them from a computer through another XBee.

Here is below a screenshot of the data received on the XBee hooked on the computer:

Also some sample data as stored in the CSV file:

Date Time Temperature © Battery (V)
2012/6/3 13:27:59 27.00 3.81
2012/6/3 13:28:9 27.00 3.81
2012/6/3 13:28:19 27.00 3.83
2012/6/3 13:28:29 27.00 3.81
2012/6/3 13:28:39 27.00 3.81
2012/6/3 13:28:49 27.00 3.81
2012/6/3 13:28:59 27.00 3.81
2012/6/3 13:29:9 27.00 3.81
2012/6/3 13:29:19 27.00 3.81
2012/6/3 13:29:29 27.00 3.81

In order to simplify this code quite a bit, I created two classes dedicated to battery usage and power management.

You can find the complete project on GitHub.

Don’t forget to go through the requirements section in order to properly set up your Stalker and your XBees.

A Few Stalker v2.1 Glitches That Can Easily Be Solved

| Comments

I finally received my order at SeeedStudio last Wednesday. It came nicely packaged and until yesterday, I had not a chance to test the Stalker. After a few hours playing with it, I must say that this is a really cool Arduino board from which you can do plenty of stuff.

I went through the tutorial for the Stalker v2.1 on the Wiki and experienced a few glitches for which I found solutions that might help some of you :–)

The problems I had where mostly related to:

  • compatibility with Arduino 1.0
  • interrupts

Waiting for an Order at SeeedStudio

| Comments

I’ve just placed an order yesterday at SeeedStudio. Plenty of interesting stuff to play with for quite a bit :–)

Seeeduino Stalker – Waterproof Solar Kit (x2)

I’m getting more and more interested in XBee/ZigBee networks so the Stalker with be something interesting to play with. I already have a bunch of XBee Series 1 modules, I plan to order some ZigBee ones later on, probably via Mouser.

I plan to use ZigBee modules instead of XBee ones mostly because of the Mesh topology I’m interested in. I’m still undecided regarding which ZigBee modules I’ll buy: probably non-Pro for outdoor projects and Pro version with RPSMA antennas for indoor (I hope to get one day some interesting Home Automation ZigBee modules and the Pro version is the only one that will ease the integration with those 3rd party modules).

Energy related stuff

  • 3W Solar Panel: the 0.5W panels included in the Waterproof Solar Kit are interesting because they fit in the enclosure, but I’m wondering what a larger panel might mean for a few outdoor projects I plan to work on
  • LiPo Rider Pro with 2 x LiPo 6A: I assume the built-in LiPo charger in the Stalker won’t be beefy enough

Various things

Now I have to wait a few weeks ‘til I receive this stuff. Will let you know how this turns out.

Meanwhile I’ve been working on the project I briefly talked about in the previous post (more on that in a post later on), and finally got a chance to work on the Pololu Robot I had bought a few weeks ago.

Playing With Electronics and Textiles…

| Comments

I bought yesterday a LilyPad TechStyles Kit from Lextronic.

This is a really simple kit with which you can easily start sewing some electronics.

I bought it because it comes with some handy parts, like the switch, the coin cell battery handler and some few LEDs.

Here is what you end up with after it’s completed (you can’t see well the blue LEDs turned on):

Turns out I spent quite a bit of time sewing :–)

I guess my skill will improve with time & training.

I will soon talk about about a homemade gift I started to work on today for an anniversay. This gift will be based on some scrapbooking stuff (not done by me! :–)) and will use some LilyPad stuff in order to enhance it.

More on that in a few days.