Showing posts with label bluetooth. Show all posts
Showing posts with label bluetooth. Show all posts

Tuesday, January 12, 2016

Printed PCB for RC Telemetry Bluetooth Interface

This is an extension of the previous post.

I have been toying with the idea of putting together a control system for my smokers. It involves sensing temperatures and controlling a fan and doing some display. Pretty simple stuff for a Teensy or Arduino, but when it comes to uploading that data to the internet, those platforms fall a little short. That is where a Rasperry Pi shines. So the idea is to make a board that mounts on a Pi and is able to communicate with it, as well as do the control stuff. This is very similar to DIY controller called the "Heater Meter" (link to the store). This is going to be a very complicated board, but I thought that using the technique of leveraging a Teensy, like I do with the RC Interface would make sense. While doing the research on the Heater Meter, I found that they have their boards fabricated by OSH Park. OSH Park grew out of a club that assembled small pcb boards into a single panel and then had that made by a fabrication house. That is another story told better on their website, and not mine to tell, But the best part of it all is that OSH Park can make 3 copies of your board for $5 per square inch. That is a fantastic price and you usually only have to wait 2-4 weeks to get your board back. For my board below that ended up being about $22 or about $7.33 each. So why does this matter for the RC Telemetry Interface? Well, I figured that I needed some practice using the software that is used to create the schematic and design the board and I also wanted to see how the whole process worked, so I thought I would use the RC Telemetry Interface to learn how it all worked.

The software I used is the free version of CAD Soft Eagle, so I set out to learn it and to create the schematic and board for the interface and here are the results.

The circuit is as described in the previous post, but I added two buttons, and LCD screen and an LED. Here is the schematic.
Schematic for the RC Telemetry Interface

Pretty simple really, but the fun part is when you switch to designing the board. Even with the simple schematic shown above, the board gets pretty complex. This is the version 1.2 of the schematic and board; the boards pictured below are from the first version and there are some differences.

The picture below is the layout of the board, and what might not be apparent is that the blue lines are on the back side and the red lines are on the front. Also, all the parts are actually mounted on the front, this means that the LCD panel will mount on top of the Bluetooth module and the Teensy. I did this to protect the Teensy's program button, In the first version, I put the Teensy on the back, but the "program" button kept getting pressed when it is set on a table. This solves this problem and makes for a compact package. In addition, having the Bluetooth module on the front under the LCD allows me to see the blinking light that indicates the state of the module. You can not see it directly, but the flashing light is pretty easy to see around the LCD.

You can see that I have the two buttons positioned below the LCD and an indicator LED as well since it might be hard to see the Teensy's LED. I also placed the SPECTRA interface on the top, so it is easy to see if it is plugged in or not. Last, I have added a plug and an on/off switch that allows the unit to be powered from a LiPo battery. The plug fits the batteries available from Adafruit.

Board layout for  RC Telemetry Interface


Here are pictures (front and back) of the board that I had made from OSH Park:



And here are some pictures of the first version with the parts attached. Note, I placed the Teensy and the LCD using headers so that I could remove them for testing and debugging. Also, I made a mistake in the schematic for the Bluetooth module, getting the Rx and Tx lines not connected properly, so you can see that I had to use wires to connect it, this is fixed in the new version.






If there is interest I can post the Eagle files or point you at the projects on OSH Park's website.

Matt

Thursday, November 20, 2014

Connecting a Raspberry Pi to the Anova Precision Cooker

I backed a Kickstarter campaign to bring a new version of a cooker that allows a home cook to use the "sous vide" method of cooking just like fancy restaurants. The device is priced far below commercial units available, but performs exceptionally well. This new device is the Anova Precision Cooker and can be ordered here. This device sports a Bluetooth interface so that you could program and monitor the unit from a Bluetooth enabled device. Being a geek and software developer, I opted to support at the "Hacker" level which gave me early access to a prototype unit so I could work on developing an app or other software for the device.

I also recently purchased a Raspberry Pi B+ from Sparkfun.com and had been tinkering with all sorts of things on it. As a side note, I also purchased a cool Plexiglas enclosure from Adafruit industries, I highly recommend it, she makes them on site and it is a perfect fit and looks cool. The Pi is a great little platform and can do all kinds of things big computers can do at a fraction of the price. Currently I have it interfacing to my weather station and posting the weather data from my backyard up to the Weather Underground, I thought it might make a good platform to interface to the Anova as well; this brings me to the point of this post. 

Once I got the idea of interfacing to the Anova unit from my Raspberry Pi, I did a little research and found I needed to purchase a Bluetooth dongle that would be compatible with the Anova. Since the Anova uses Bluetooth LE, the dongle must also support that and I needed one that had already been successfully interfaced with the Raspberry Pi (no need to re-invent the wheel here). The one I chose is based on the Cambridge Silicon Radio and I got it from DX.com from their USA warehouse: ultra-mini-bluetooth-csr-4-0-usb-dongle-adapter.

So with the Pi, dongle and the Anova unit in place, it was time to see if I could interface them. My research found an awesome resource on eLinux.org on how to get Bluetooth LE working on a Raspberry Pi and I followed this almost exactly to get my Pi to talk to the Anova. Here is the blog post: http://www.elinux.org/RPi_Bluetooth_LE. The following pictures correspond to particular steps in the posting and I have tried to reference each of them for the pictures.

I followed all the steps up to the "First Test" header in the posting to get the proper software installed, configured and working on my Pi.Next I followed the instructions and the picture below are my results when following them.

Results of "lsusb" with the CSR BT Dongle plugged in
Doing a detailed "lsusb" on the CSR BT Dongle

Results of the detailed "lsusb"
Results of the "hciconfig"
Bringing the CSR BT Dongle "up"
Results of the "hcitool lescan" command
Results of the "hcitool lecc" command
Now the posting deals with accessing the Bluetooth device from using Python. I followed the instructions to build "bluepy" on my machine and then issued the command as described in the posting. My results follow and show that the software was able to connect to and identify the Service and Characteristic that is used to send commands to the Anova.

Results of running "btle.py"
That's it for now, the next step is to take the btle.py Python code and update it to send a command to the Anova. This is simply done by writing to the Characteristic with its value set to a recognized command (status, read temp nn, write temp nn, etc.).

 -Matt-