Thursday, September 23, 2010

*This application is tested only with Samsung Galaxy GT-i5700 Spica (rooted Android 2.1 OS, i570EXXJD1 Baseband version).
The transmitter circuit uses Microchip's dsPIC33FJ16GS504 for the analog-to-digital conversion of the input signals on two channels.
The processed data on the dsPIC are then transmitted to the phone (for waveform display) via the LMX9838 bluetooth SPP module.

The source codes for the bluetooth communication is based on Bluetooth Chat example from http://developer.android.com.
That example contains three java source files. And, I've completely copied the "DeviceListActivity.java", which is used for searching remote bluetooth devices.
Then I've modified the "BluetoothChatService.java" to use only the RFCOMM Client functions,
and used the well-known UUID "00001101-0000-1000-8000-00805F9B34FB" for the Bluetooth RFCOMM/SPP.

For the plotting of waveforms, I'm using SurfaceView object to draw on its canvas.
This tutorial found on www.helloandroid.com helps me a lot for this task:
"How to use canvas in your android".

The rest of the job mainly involves porting of my previous Python S60 script to JAVA language.
It was too painful on my side, because I had to convert a single script file to multiple java + xml source files!
Nonetheless, it was a good experience for me on learning the Android SDK (JAVA programming).

Special thanks to:Samdroid Forum for the customized/rooted firmwares for our Spica.Tipidcp Spica users for sharing their tips and experiences with this android phone.

----------------------------------------------------------------------#edit (10-15-2010)
Here's now my circuit. Nothing special on it, all are based on existing circuits.

*The dsPIC I have used is most probably NOT the best choice for this project because of the many left unused peripherals (extra pins). But, this is the only part readily available in my bin and it has the fastest ADC (2 x 2MSps) among the chips I have.*If you prefer to change the input range via the op-amp preamp, the computation is located on the "adc.xmcd" file.*You can use other SPP bluetooth modules aside from LMX. (accdg to manufacturer, it's already obsolete)

It's almost a year now, and yet some people are still interested in this project (considered to be obsolete). So I've decided to place the source repository also onGoogle Codesite. You can eitherBrowse or use git to have your own local copy:

git clone https://code.google.com/p/android-bluetooth-oscilloscope/

See also theChanges, if you want also to learn on how to modify the code. I've started the first 'commit' with a simple "hello world" from the SDK project template. And then changes were made until the desired final oscilloscope application is achieved.

@ jarkman & tronixstuff,I don't have any plans of selling clones of my circuit. Otherwise, you'll just get poor customer support of my product. LOL.Not tested but I think it will also work on stock firmware. But still, it's recommended to use rooted firmware for better performance.

@ "Anonymous" (10-20-10),Aside from lowering the input voltage, the opamp configuration also allows the oscilloscope to accept both positive and negative input signals. It also acts as "buffer" to the input of dsPIC's ADC module.

hi yus its a great job i am very much interested in it and i am dng the same project of yours but using a different board i.e., induino board so can you please suggest me with your previous project details

Hi, I have a "Quick and Dirty" program in Delphi to simulate the pic transmission in Windows. This was made to test the Android program in my Motorola Droid. The screen look garbaged and the signal display is small but the programs work together. How can I post the program so anyone can use it?

It seems that you're already hooked up with this project.Please send me your email add. so that I can give you a copy of the whole project (AndroidSDK + Eclipse IDE).From there, you can also modify the layout, communication protocol, controls, etc.

I'd like to get a copy too please! I downloaded the files and started building them and realized all the resource files are missing. Some of them are easy to recreate but others are more complex. My email address is rapjr (at) cs.dartmouth.edu

Using Bluetooth, I managed to control a 4x4 Robot (Drone) remotely, using my Android G1. I'm using a serial connection over bluetooth, from the Android to a Bluetooth Chip connected to an ATMega8 on the ROBOT.

I have a few disturbing me questions.Datasheet for LMX9838 says that "UART Command/Data port speed up to 921.6kbits/s" see http://www.national.com/ds/LM/LMX9838.pdf.Is it real to observe correct waveform for signal with frequency about 200 KHz?And if UART speed is 921.6kbits/s then can be used some slower ship?

Some ideas and questions:Q: I see that you have an opamps of course at the inputs. Is it for amplification only or also for filtering to limit aliasing? What cutoff frequency do you use in the filter?Idea1: You could use a digitally controlled potentiometer at the input opamp to control the amplification. (I used one when I built BT ECG, with this opamp AD628ARZ).Idea2: The obvious part is that you can't send continuously a signal of bandwidth higher then the BT connection allows. What you could do is assume that the signal is periodic (maybe depending on mode of operation) and sample with higher ADC rate of 2Msps, but only a given number of samples. It would have to be synchronized to some trigger (as in all oscilloscopes rising edge, falling edge etc) and limited in number of captures per second(in order not to exceed BT throughput). That would allow the system to register higher frequencies, without trying to push to much data through BT. Idea3: HP I think had some techniques of acquiring periodic signals of higher frequencies then their ADC allowed, buy sampling signal several times and then putting the data together to form one waveform. That means that the effective ADC sampling rate was increased by the number of sampling repetitions. The keypoint in that was the proper timing (for example sample one frame in 1ms, 3ms, 5ms, 7ms etc from trigger and the other frame in 0ms, 2ms, 4ms etc from trigger) and then form one waveform. I'm not sure if it would be possible to create such accurate timing with internal ADC in uC. I like your design very much. I tried to present my ECG waveform in TYTN2 on windows mobile, but I couldn't force it to display data fast enough. Kudos to you!

I like your project ! I just installed the application on my Galaxy 5. It turns out well just that since my screen is a bit smaller, I cant get a complete view of the application. May be I will work on the application size based on your code. Thanks for the sharing !

Thanks A lot sir for written a great article, This is really informative. and will be very useful for the future also. now I want to share it to all my friends. I am sure that They will also get knowledge through this Article.

hey, I would love to play around with this. would you mind sending me the complete android source for android sdk and elclipse ide? My email is aviHiriyanna@gmail.com. Would appreciate it greatly. Great job on this though!

Great job!Other then by bluetooth , can it be done with direct communication , through the usb port for example.I'm asking this because the TV out (D to A) option already exists so i was wondering if the opposite (A to D) action is possible.I'm working on a application that uses external analog input (like camera) convertes it to digital and performes varius actions.

^ hi,Direct connection to usb port is possible, particularly to those phones which have USB HOST functionality (e.g. using usb-to-serial adapter).I think there's already available similar android app in the market which uses the mic input for the ADC.

Evan Richardson : I've just downloaded your files and in looking at the Boardv4.brd it seems that you have not finished the routing?I think the two signals TXD and RXD must be in differential pairs to work properly.I've tried the application (.apk) on my phone(Xperia X10i) and some views like windows for viewing signal must be adapted depending of the size of the screen (4" for mine).

It's a great idea!I'm new to Android.I was looking for canvas and found your project by chance.I've tried to do it by myself; but, it didn't work.Could you send me your complete (Android+Eclipse) project?

Excellent project! Please send me all the source files, because I would like to rewrite the program on WM6 (Hp hx4700). My e-mail: dudnnn@freestart.hu. (if you are ready to send the results.) Thank you!

Hey yus, i've been working with the android manifest file that you posted for a couple days now, but i am having trouble with the layout files for the oscilloscope, is it possible for you to send me a copy of the complete project? I am attempting to connect the bluetooth oscilloscope to my new acquired galaxy tab, so i can connect it to a circuit that I have built for a wireless ECG project!!! Again, i would really appreciate it!

That was really exciting. I have a question about android you used. I draw a graph in android but I need to shift it to left side or right side. I saw that when you draw your graph you shift it, I wonder whether I can ask you how can I shift my graph too. It's worth saying that, I don't want to scroll my graph I want to shift my graph in one page like the same thing you do that.In advance I want to thank you for your help.Email: Saeid.Hamzehee@Gmail.Com

Dear My friend,I send the source code for you but I didn't receive any thing from you yet. I wanted to be sure you have received my Email or not. If you didn't received any thing. Please let me send it to you again.

please I want everything related to this project Android+Eclipse, plus the Delphi sources mentioned :-) I loved this project and I'd like to start with Android development (I'm levaing nokia behind soon) my mail is venomghost@gmail.com keep the good work is amazing

Hi YusVery nice work. I would also like the completed sources code, if that's ok:martin.rodgaard@gmail.comI am thinking about using the a RN-42 Bluetooth module instead:http://www.sparkfun.com/products/10253As well as do a redesign of the input op-amp stage.I like the ideas Mikuslaw is suggesting, could bee very interesting to here if you or Mikuslaw make some of thees improvements.

Very good. I have been used Amarino library for bluetooth communication. I found your code is better in terms of simplicity and readability. Could I have a copy of project file also?. (email: mtshon@gmail.com)

I wanted to thank you for this excellent read!! I definitely loved every little bit of it.Cheers for the info!!!! & This is the perfect blog for anyone who wants to know about this topic. You know so much its almost hard to argue with you .........thanksFarbkorrekturmasken

hi Yus ,I am an e&tc student and like to do your project for fun .. I do not want the entire source code but need a small help from your side. I need to know how do I start with the project and if there is anything missing what is it (So that I know what I have to fix before hand and then i can try debugging and modding) . My email id is akshat01@gmail.comanyways I am starting to build the hardware part with your schematic. thanking you in anticipation

Hi, nice project you have there. can I have the required files too so that I can work with it? I'm planning to display real time data via bluetooth from my mcu connected to pressure sensor. :) My email is superhuat@hotmail.com. Thank you.

Thank you very much for the inspiration. I'm an IT expert and am planning to rebuild (or restructure) your apk to fit my HTC handset and modify the hardware transmitter to an AVR chip. Congratulations =)

I think you are right when you say this. Hats off man, what a superlative knowledge you have on this subject…hope to see more work of yours.I think you are right when you say this. Hats off man, what a superlative knowledge you have on this subject.

This is such a nice and Informative, amazing blog. I like it so much. its really very informative. The topic you have discuss is very sensitive and important. You have describe it in very good manner. I appreciate your hard works. thanks for all this.

nice project bro.it ll be nice if you could add a seperate adc module ande keep small pic just for comminication.gonna try this on my se x8.i got bt module in hand and will have to port hardware to small pic i havr thoigh it looses sampling rate.is there any alternative for opamps.they arr hard to find

hello! your blog really made my day today! your project is really similar as my final year project. can u give me copy of the source code? this is my email: roshield_r@yahoo.com. really appreciate it if you can share this. thanks in advance!

hivery nice project. am trying to build one too for an academic purpose but not with all these functionality.is it possible to have your Android Eclipse source code because on the side there is not all the java codesmy email is pr.prokopiou@gmail.com if it's ok to send them to me

Hello, I want to use 8051 + ADC + BT circuits to transmit graphics data, and Bluetooth can be paired but can not send graphics data, what is the problem causing it? Test software can use the Bluetooth terminal normal receiving data. Thanks to extremely my email chinakmt0705@gmail.com

Windows Hosting IndiaWhat a great web log. I like the design and the interface. Because this blog is mind blowing and designing portion is too strong and the interface is supporting the visitors and user of this blog and i like this blog to visit.

imagens para orkutThis is very nice blog because information provided here through the article and the pictures are very effective. Because sometimes words cannot explain the things that pictures can and here the words and pictures both are expressing the things in balance.

Great innovation in this post and I think the processed data on the dsPIC are then transmitted to the phone (for waveform display) via the LMX9838 bluetooth SPP module. I think bluetooth software services will help to make this software and after that we can use.

nice work!i want to use Bluetoothchat example in my android app. i want to control simple on/off of some application using android and Bluetooth. would you please show me the way. i am new to java and android

great project! And many features could be added to make a real oscilloscope from this (triggerring, data storage, etc) Of course, bandwidth will be limited to 1MHz, but this is enough for audio signals...Is someone else working on it? I would like to share ideas with other developers.

@ Mark James: Yes, it is possible to replace lmx9838 with a cheap CSR BC417143 based BT module.I started to build my prototype with one of these modules and modified the code to make it work with a dsPIC33FJ128MC706.I am just at the very start of the project and have still some strange uart behavior, but I already managed to display some traces on my old Spica at the default 9600 baud rate. One of the next steps will be to modify the Android interface for hi resolution screens (Galaxy SII)

Hi,Nice Work Man....I am hobbyist and planning to make this oscilloscope for the ECG application.It would be a great help if you can send me all the required source file(Android SDK + Eclipse IDE). I really need it urgently for my work. I would be really thankful to for your help. Can you please send me files in below email id:girishnayak12@gmail.com

I really want to learn and explore more about your project, and this will be a great help for me in understanding more about android. Can you please send mo the whole project (AndroidSDK + Eclipse IDE) and delphi testing the program.

I'm new to android app but have over 15yrs experience in MCU/DSP and windows programming/dev. I see your work that was a great job. It is a good example for me to learn android app development. Would you please send me a complete project code (AndroidSDK + Eclipse IDE) so that I can get a good starting point?

This is very inspiring, as getting from the start & Having no real background in programming (aside from making some adventures on ZX-81 and MSX), I want to get started on developing something for my own Android based eBook reader and android app development training even this online course seems to be interesting http://www.wiziq.com/course/13599-professional-android-app-development-training-1-on-1-sessions. Has anyone tried any online courses so far. Please do provide a light on this also.

hi yus, im very interested with your project, because your project is one of project that i need to finish my final project in my college. my final project is about Electromyography with user interface in android. same with your project, i also need to show wave from my hardware in android. and now im still confuse how to do that?...can you me to share your full sourcecode to me? because im really need it...if you can, please send to nanang.pens@gmail.com. i hope you can help me sir...thank you

hi yus, your project is one of project that i need to finish my final project in my college. my final project is about Electromyography with user interface in android. same with your project, i also need to show wave from my hardware in android. and now im still confuse how to do that?...can you me to share your full sourcecode to me? because im really need it...if you can, please send to ngdkhiem89@gmail.com. i hope you can help me sir...thank you

Hey Yus, Thank for posting this project. I realize its been long 2010, are you still supporting (kind of) ?I am planning to take over this project and add a few upgrades from your original idea. I dont know how to program the Bluetooth communication and I would like to add a few hardware functions on the dsPIC33FJ16GS504. Like, multirange selection of input and maybe a few other things. Before I start this venture I was hopping that you accept to commit in supporting me when (and I will) hit some difficulties in the programming. I may decide to select another chip or maybe not. So my question to you is are you still involved in this project ?

Dear Sir, I am making a project to receive the PCM data from hardware. The hardware will send a sound to Android phone by PCM format. I saw your code. It use read function to read bytes from socket. But I not sure it is possible to receive PCM data? Please let me know you code can do my task or not? Thank you so much

Hello, i REALLY liked your project! A LOT!!! And good news: it does compiles with C30 and XC16..My only problem is that i can't load the android software into phone. Is there any *,apk? Any guides how to compiler the android software? If yes, my email is vagyver@gmail.com