Note: do the initial tests with the bluetooth dongle straight on the machine (Udoo in my case) instead of plugged in a hub. Scanning works on a hub but for some reason rfcomm doesn't connect very often if the dongle is on a hub.
Quick hack #1:
Check if we can see the device:
root@imx6-qsdl:/home/ubuntu# hcitool scanScanning ...
EC:FE:xx:xx:xx:xx IR-Blue-DM
Same using LE:
root@imx6-qsdl:/home/ubuntu# hcitool lescan
LE Scan ...
EC:FE:xx:xx:xx:xx
Check if we need a pin:
root@imx6-qsdl:/home/ubuntu# bluez-simple-agent hci0 EC:FE:xx:xx:xx:xx
Release
New device (/org/bluez/5683/hci0/dev_EC_FE_xx_xx_xx_xx)
Seems we don't need one, connect using rfcomm.
root@imx6-qsdl:/home/ubuntu# rfcomm connect hci0 EC:FE:xx:xx:xx:xx
Connected /dev/rfcomm0 to EC:FE:xx:xx:xx:xx on channel 1
Press CTRL-C for hangup
^CDisconnected
See if there is any data:
root@imx6-qsdl:/home/ubuntu# cat /dev/rfcomm0
And after you do 'echo >/dev/rfcomm0 "R001\r\n"' in another terminal there is data!:
E211208208208215214212212218220218213222223221218223223221216224225223220227226225222226227225223228228227225229229228225229228229228229230230228230230229230230230231230230230229229227229227227188188188188205205196196205205205196205205205205213205205205205213205205213213213205213213213205213213222213222222222213222222222222222222222222222222222222222222222222222222222222213222222222 0 17 17 10 41 62 62 52 79 86 96 90103121124107131152159138159162169148169183183155179186186162179193193159176190190165176186183148172172176131151158158120124138145 96103107110 65 69 75 68 23255255255255255255255255255255 0 0 0 0 0 0 0 0 0216221205 0 0 0 8150 26 17 93105 36230 79 40 34 0128 0 0255 33 0188 26190 59 25245 27150 26255 30116 91166 32136 44 10 33 1 26EX
R144006836145-00045I -54 -54 -52 -54 -53 -54 -51 -50 -52 -50 -52 -49 -50 -50 -49 -47 -51 -51 -51 -49 -52 -50 -50 -48 -48 -50 -45 -47 -45 -43 -42 -44 -41 -42 -43 -45 -27 -41 -43 -44 -40 -41 -41 -43 -42 -42 -42 -42 -44 -43 -43 -42 -42 -43 -42 -42 -42 -41 -42 -40 -42 -42 -42 -41X
Quick hack #2:
Use a small python routine to read data:
import serial
import time
ser=serial.Serial("/dev/rfcomm0", baudrate=57600,timeout=0.1)
ser.open()
ser.write("R001"+chr(13)+chr(10))
while (1==1):
d=ser.readline()
print len(d),d
Success! Now to write something that gets temperature values and shows the result graphically...
I found the R001 command in the android code on http://github.com/RHWorkshop , the H command can be used to increase the speed at which the data is sent.
20140106
20130824
Teamviewer - using aliases
I really like teamviewer (free for personal use), after creating an account and running it on most of my machines and my android tablet the one thing i couldn't find easily figure out was why one of my machines had a human readable name and all the others showed up with just the teamviewer id.
The annoying thing is that only the machine with the human readable name has an option to change its properties and the others only allow me to connect to them. Googled for an answer for ages, must be a typical case of me searching using the wrong keywords or nobody else trying to do this...
Finally after messing around for ages i found that i had to add the machines manually in computers and contacts (not logical as they're in my list already...), then you get the option to add an alias (grumble: why do have to type in the teamviewer id - would like to see a rightclick option for that).
Great now i'll be able to connect to the correct machine in one go without having to memorize the teamview id.
As a 'benefit' the machines are now listed twice: directly in the 'my computer' list and once under my account. And there must be some logic as to why the machines show up yellow (idle) under the account but green (active) in the 'my computer' list.
The annoying thing is that only the machine with the human readable name has an option to change its properties and the others only allow me to connect to them. Googled for an answer for ages, must be a typical case of me searching using the wrong keywords or nobody else trying to do this...
Finally after messing around for ages i found that i had to add the machines manually in computers and contacts (not logical as they're in my list already...), then you get the option to add an alias (grumble: why do have to type in the teamviewer id - would like to see a rightclick option for that).
Great now i'll be able to connect to the correct machine in one go without having to memorize the teamview id.
As a 'benefit' the machines are now listed twice: directly in the 'my computer' list and once under my account. And there must be some logic as to why the machines show up yellow (idle) under the account but green (active) in the 'my computer' list.
20130703
Key-fob is sorted, can we do the same for URUK WiFi Router Module (Arduino Compatible)
Cool! The Pi-Lite key-fob (see yesterday's post:Get a Pi Lite and we'll all a Pi Lite key-fob as a bonus!) should be happening as they went over £10K today.
Can we do the same for URUK WiFi Router Module (Arduino Compatible) , i'd like to get one of those ... currently at just over $6K, there is another week to get it funded at $10K.
Can we do the same for URUK WiFi Router Module (Arduino Compatible) , i'd like to get one of those ... currently at just over $6K, there is another week to get it funded at $10K.
20130702
Get a Pi Lite and we'll all a Pi Lite key-fob as a bonus!
There is always something interesting on Kickstarter...
Pi Lite white - Bright white LED display for Raspberry Pi
If they reach £10K (easy, the project is over £9 already) we'll all get the Pi Lite acrylic key-fob as a bonus, so go on get one!
Pi Lite white - Bright white LED display for Raspberry Pi
If they reach £10K (easy, the project is over £9 already) we'll all get the Pi Lite acrylic key-fob as a bonus, so go on get one!
20130426
Don't have a 3D printer yet? Do something about it!
A couple of Kickstarters worth looking at:
Rigidbot (build volume: 10"x10"x10" / 25.4x25.4x25.4cm or 12"x16"x10" / 30x40x25.4cm)
Some people are worried that they're not going to reach all their stretch goals... The initial goal was only $31.5k, now to get the heated print bed they need 31.7x that, currently they at almost 60%. You can make it happen!
Cyrus (build volume: 10"x11"x12")
Almost half way to the goal, looks great. Like shiny things? Like Swarovski gems? Then go for the Great Reward whilst it's still available. Don't forget to add the heated bed, lcd and dual extruder!
So you choice is simple: get a Rigidbot. Or a Cyrus. Or a couple of both. Or 31 Cyruses / 750 t-shirts! Come on, what are you waiting for?
36
And whilst you're at it don't forget to get a couple of these: Doodle 3D Wireless 3d printing and a way to get the kids hooked also (kids: sell it to mom and dad as an educational tool and you'll get to play with the 3d printer once they're bored with it), what more can you ask for?
Rigidbot (build volume: 10"x10"x10" / 25.4x25.4x25.4cm or 12"x16"x10" / 30x40x25.4cm)
Some people are worried that they're not going to reach all their stretch goals... The initial goal was only $31.5k, now to get the heated print bed they need 31.7x that, currently they at almost 60%. You can make it happen!
Cyrus (build volume: 10"x11"x12")
Almost half way to the goal, looks great. Like shiny things? Like Swarovski gems? Then go for the Great Reward whilst it's still available. Don't forget to add the heated bed, lcd and dual extruder!
So you choice is simple: get a Rigidbot. Or a Cyrus. Or a couple of both. Or 31 Cyruses / 750 t-shirts! Come on, what are you waiting for?
36
And whilst you're at it don't forget to get a couple of these: Doodle 3D Wireless 3d printing and a way to get the kids hooked also (kids: sell it to mom and dad as an educational tool and you'll get to play with the 3d printer once they're bored with it), what more can you ask for?
20130111
Arduino + Canbus shield + GPS Receiver - update 1
A quick update on my Arduino + Canbus shield + GPS Receiver post from last year.
I had this plan to put the files in a sub folder in order to make sure that i would hit the limit to the number of files in the root of the file system, added a bit of code that would create up to a thousand files. Somehow it didn't work: didn't want to write in the sub folder...
But why use separate files anyway? The files will be evaluated on my main machine, it's easy enough for it to split the file. That simplifies the code a lot:
void start_new_file(void)
{
digitalWrite(LED2, HIGH);
// we want to add to the end of the file file and flush manually for performance and to be nice to the sd card
file = SD.open("DATA.TXT", O_READ | O_APPEND | O_WRITE);
digitalWrite(LED2, LOW);
}
Also spotted the post Why is the SD library slow? and decided to flush the file manually. Performance isn't really an issue but fewer writes to the SD won't hurt! I flush before checking for the click.
I had this plan to put the files in a sub folder in order to make sure that i would hit the limit to the number of files in the root of the file system, added a bit of code that would create up to a thousand files. Somehow it didn't work: didn't want to write in the sub folder...
But why use separate files anyway? The files will be evaluated on my main machine, it's easy enough for it to split the file. That simplifies the code a lot:
void start_new_file(void)
{
digitalWrite(LED2, HIGH);
// we want to add to the end of the file file and flush manually for performance and to be nice to the sd card
file = SD.open("DATA.TXT", O_READ | O_APPEND | O_WRITE);
digitalWrite(LED2, LOW);
}
Also spotted the post Why is the SD library slow? and decided to flush the file manually. Performance isn't really an issue but fewer writes to the SD won't hurt! I flush before checking for the click.
20121029
Android development
Ages ago i had a look at Google's development environment, found it rather complex and then it was discontinued.
Today i stumbled over some documentation based on http://www3.ntu.edu.sg/home/ehchua/programming/android/Android_HowTo.html which again was more complicated than it need to be.
My steps:
Today i stumbled over some documentation based on http://www3.ntu.edu.sg/home/ehchua/programming/android/Android_HowTo.html which again was more complicated than it need to be.
My steps:
- install JDK from http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html
- install Eclipse Classic 4.2.1 from http://www.eclipse.org/downloads/ and untar
- run eclipse and from Help -> Install New Software -> Add add https://dl-ssl.google.com/android/eclipse/
- restart eclipse when it asks for it
- from Windows -> Android SDK Manager install the tools, the android versions you're interested in etc
- now you can create a virtual android device from Windows -> AVD Manager.
Subscribe to:
Posts (Atom)