Author Archives: pierremuth

Icebreaker Game

Abstract.

12026610_10207455771046540_1864584773_nAfter experimenting with the small receipt thermal printers and manage to make a portable camera, my brother came up with a very clever idea. He is organizer of a juggling convention, and he looked for a kind of funny game around beer selling and their receipt. The aim was to entertain and offer a beer every lets say 50 sold. He said we can do more than print pseudo randomly a winning ticket based on certain ratio.

The idea.

beerWe imagined a machine standing on a bar, with on the client side a camera pointing at you, a screen showing the camera output and few instructions. On the back side, a single button allowing the barman to launch the lottery for one ticket. What the machine do once you press the front big button (I really love these Adafruit massive buttons!), is taking a picture of you. And then there is two possibilities. If you loose, a souvenir receipt is printed with the picture of your face and a random funny quote. If you win, a winning receipt with the face of someone else is printed, and instructions telling you that if you find the random guy on the printed picture, you both won a free beer.

The printer.

2321The printer choice should consider reliability, speed and print
quality. Even if the last one is relative to what we can expect for black or white thermal printing. I moved from the affordable and small serial Adafruit 58mm printer to a more professional one. After some non conclusive test with a cheap 80mm Chinese printer, I finally get an Epson point of sale printer. The TM-T20 is USB and commands are very well documented on their website. If not set to the maximum print speed, they could make surprisingly good prints for bitmap pictures. It depends a bit of the paper quality as well. I get very nice results with BPA-free recycled paper roll.

The system.

Raspi_Colour_ROnce again, the raspberry pi is a nice card and of course perfectly capable of doing such a process. There is the official camera module, even if a basic webcam would make it as well, USB ports for the printer, HDMI for a screen, GPIO for buttons and leds. But most importantly, I can reuse a lot of code form the Polapi.

The software is written in Java and uses two external libraries. One for GPIO – Pi4J and an other one for USB – usb4JavaIn addition, the native raspbian program raspividyuv is used to get the camera frames. The camera output is on top of everything and always visible on the screen. The all Java software part is hosted on github. The runnable Jar file must be launch on the Raspbian LXDE environment and could be easily auto-launched. There is some logs here, but I must complete them a bit.

The case.

In the view to avoid yet another device taking dust in the garage, I made the case looks like an arcade. I just have to exchange the front panel to have a raspberry pi Mame machine ! (That will instead probably take the dust of the attic, but with style, surrounded by retro consoles)

Wood sawing 

Case filling

Resulting device

Outlook.

It was quite a success on the Juggling convention, it brought fun and few free beers ! It ran smoothly without any reboot despite I expected some bugs.

After being used on a week-end for around 500 prints, it will be used on a Hackathon in Geneva with a slightly different mode.

IMG_20160408_120647

8918261459861376809

Advertisements

The BIG_CLOCK

We need clocks. Once you have passionate activities which absorbs all your attention, if you want to keep contact with the social society surrounding you, it’s crucial to know when we are.

From this observation, it started this project with the wish to use the big LCD panels which take the dust somewhere. They are Lumex LCD-S101D30TR, 7 segment digit 3″ tall. The micro controller is a PIC18F87K90, and it does everything. So the hardware comes down to only a battery, a micro (with surrounding capacitors and an oscillator) and 6 LCD panels.

 

The digits are soldered on prototyping boards, which are screwed to two long rods. A basic white surrounding plastic frame, and I think it does the job!

521631455984494909

No relief now to say “Oh god, I didn’t see the time passing while I’m playing….”

1929151455985127238

For details, go to the hackaday.io project page : https://hackaday.io/project/9687-bigclock

2906641456482643758

 

Wireless temperature probe

Here is an attempt to give some information on the wireless probes I’m using with my Raspberry pi logging station (for the full story). The wireless link is performed by nRF24l01+ modules.

1- Reception

The data reception is done by directly connect a nRF24l01 module on the raspberry pi SPI port. And the pilogger java project  configure and handle the data reception/treatment, thanks to the Pi4J library.

2- The probe

To sense temperature without using long wires, there is a constraint to consider: the wireless module powering. It could be for example from a solar panel, or from a battery. Using a solar panel is not always possible. In case of measuring outside temperature, the solar panel should be deported to the sensor, as the sensor should not be exposed to the sun. Moreover, the charging circuit efficiency is critical for small sized module.

Powering only using battery simplifies the module but requires very low consumption component to last a reasonable time. The nRF24l01 wireless transceiver is very efficient on that way. To keep a very low consumption, I choose the MAX31723 temperature sensor. It is precise and uses the same SPI communication protocole as the nRF24l01 module. To manage these components, I choose the microchip PIC16F1825.

The schematics files of the module below could be find on the github pilogger repository.

wireless_sch

As well as the PIC code in C. The code put the micro-controller in sleep mode for roughly 4 seconds between each temperature measurements and transmissions. And the all circuit is powered directly from two AA Ni-MH batteries. Each components could still work down to the lower battery voltage of roughly 2 volts, and charged batteries are around 2.6 volts which is below the max 3.3 volts of the RF module.

I didn’t yet make printed circuits, then I use prototyping board such as :

In addition of the temperature, I used the internal voltage reference of the PIC to get the battery voltage and send it to the pilogger.

For the moment, I did two of these probes. One is outside in a waterproof case powered by two 1000 mAh AAA  Ni-MH batteries, and  one on the attic, powered by two 2000 mAh AA batteries. I don’t have yet a full battery life-time. I can see the battery voltage decreasing very slowly over a month, but Ni-MH discharging curves are rather flat for low current. I will update this post once probe stopped working !

Edit:

After 100 days of sending 12 bytes of data every 4 seconds, I think we can conclude the overall circuit does not consume too much energy. The two AAA 1000mAh battery voltage only drop by 40 mV. Let see if this can last one year !

out_bat

Instant-Printing-Point-and-Shoot camera

polapi01Here another project finally finished ! The Bluetooth thermal printer was fun. Unfortunately I didn’t get it work with apple i-stuff. A stand alone camera, as the Polaroid is in fact even more fun !
I used brass angle rods, glass fiber plates and screws for the case. A raspberry pi 2, this time with its own camera module. A TFT screen, the thermal printer, and a lipo battery. More details here:

hackaday.io/project/7176-polapi

pollapi02

During a party, the 3.6Ah lipo was able to keep running the raspberry pi for around 6h, plus around 100 prints !
I found a large aperture CCTV lens to get maximum sensibility. The counter part is it need to be manually focused.

It is worth to mention few facts about the paper. Thermal paper is very cheap and could be easily found without BPA, but it is sensible to sunlight and heat. Exposed to sun, the prints will fade with time.

IMG_3696

New sensor: Electrical consumption.

One of the objective I had when I started the Raspberry pi based logging system is to record the power used in the house. My first thought was naturally use a transformer around the main power cable of the house. I tried with this kind of device :

1 – Non-invasive AC Current Sensor

As it give an AC signal proportional to the intensity, it should be use with diode and filtering capacitor to be acquired by an ADC.

As you can imagine, resolution is fixed by the ADC and for low current, you get low precision.

My power provider’s meter is one made in the 60’s, the famous electromagnetical induction watt-hour meter. The metal disc makes a complete revolution every  10Watt/hour or 36KJ. If we divide these 10Watt/hour by the time the disc takes to make a revolution, we get the instantaneous power consumption in Watts.

Principle of rotation detection.

2 – Principle of rotation detection

We now have to detect the passage of short black mark on the side of the disc, and count the time between two. I choose to use a photo-resistor and a red laser diode for high brightness.

I’m using PIC 8bit micro-controllers, and instead of using the ADC, I choose to use the convenient comparator.

A divider made of a potentiometer give the fix voltage to compare with the signal from the photo-resistor. The rotating disc is like a large gear, implies the edge is made of tooth. The resulting signal from the brightness is then not pure square, but more a square with sine on top. Our comparator will see some “bounce” between the two states.

But the dark mark has certain length, brightness drops lasts a certain time. We could imagine then a kind of de-bouncing code (or hysteresis ?) . Consisting of allowing a change of state only if it lasts a certain time.

debouncing

3 – State De-bouncing

IMG_0144

4 – Laser and board installed, yes I should definitively improve this

The absolute precision of the system relies of the watt-meter and the PIC clock precision. Less you consume, more the counted time number increase then more ‘resolution’ we have.

It takes a bit of effort to tune the threshold of the comparator as well as the ‘de-bouncing’ counters. Also, aligning the diode and photo-resistor with the disc behind the small glass window is a bit delicate. To help, three leds indicate the status.

The code of the PIC micro-controller is compiled with Hi-Tech C compiler and is there : link

The logging station is my pilogger project. The RF link is made with a new address of the nRF24L01 network.

It runs now for about a month and have around 1 watt of resolution. I could identify that my fridge consume 90 watts during ~10 min every 90 min. Or that the water circulating pump of my heating system consume roughly constantly 80 watts.

chart_day

5 – 24 hours of power consumption

On the log of this particular 24 hours window, we can see the 3Kw of the traditional oven (I made a cake :oP ), the 1.5Kw of the micro-wave oven, the regular runs of the fridge, some media such as TV plus computer plus audio amp, etc…