I had to dispose of an old stationary bike that little by little fell apart. Before throwing it away I wanted to see if I could salvage something from its simple electronics. The bike has a sensor that somehow detects the rotation of the crankset and then is used to display the RPM on a small modal LCD. The “brain” of the bike is a microcontroller located below a plastic cap that is glued to the PCB so much that I couldn’t remove it, so I can’t identify the component. Everything is powered by two 1.5V batteries in series.
I took away the sensor itself and the PCB that connects it to the microcontroller that manages the display. The sensor has two terminations: one is connected to the negative pole of the batteries, the other is connected to the microcontroller and also to the positive pole of the batteries with a resistor whose colored bands indicate it’s 620kΩ. To understand what this sensor does, I hooked it up with my Arduino Uno.
The positive termination of the sensor is connected to the A0 analog input, and the sensor is powered from the 3.3V output of the Arduino through a resistance of around 620kΩ; the negative termination is connected to the GND pin. I also connected the 3.3V Arduino output with its own AREF pin to make the Analog-to-Digital Converter use the full voltage dynamic. I plan to use the Arduino as a (low-performance) oscilloscope to capture the sensor signal during various external stimuli.

Entries
chirag
2011/10/16
hey hi…….
I am working on a arduino project which will be use to take values from sensors connected to arduino and I want them to display on my pc by using python(x,y). I am little bit confuse from where to start.Please guide me as I have very little time to complete it.
Balau
2011/10/16
I think you have three parts to take care of: interfacing physically the Arduino with the sensor, writing the Arduino code (reading from sensor and writing to serial port) and writing the Python code (reading from serial port and plotting on screen). Have you seen my other blog post “Capturing an analog signal with Arduino and python“? It should give you a quick overview on capturing simple analog signals from a sensor and send them back to the PC.
I am not familiar with Python(x,y) but from what I see from their webpage it uses Matplotlib as I did, so the plotting should be similar.
The interface between the Arduino and the sensor depends very much on the sensor itself: in my example I had a simple on/off switch that triggered when a magnet was nearby, so it was basically a digital sensor, but there are also analog sensor such as this one: “Temperature Sensor + Arduino“, and there are many modern sensors which use I2C (TPA81 Thermal Sensor).
chirag
2011/10/17
Hey thank you very much fr your reply. But I want to control arduino through python(x,y) directly, i.e. without interference of arduino sketch and its environment.
Its just like I will write program in python which takes value from arduino directly.
Is it possible practically? Right now I am trying to communicate between them through firmata which is available on arduino playground of python. I will let you know about my progress incoming days.
Balau
2011/10/17
You need some kind of software that runs on Arduino because it is a microcontroller. There’s no “magic” that lets you talk with the sensor through USB, you need to put some code that does the work you need. In your case you need Firmata on the Arduino, that you can easily upload through a sketch, and some sort of Firmata implementation on Python (for example pyduino).
chirag
2011/10/21
Thank you for your kind suggestions. I have uploaded FIRMATA on my arduino uno board and it is working fine.I have tested it by using FIRMATA test and it gives no problem to me. I also have run pyduino code which you have asked me to load for communication between arduino and python. Now I have few doubts regarding the communication problem.
1. I have save pyduino code and its set_up.py in Lib->site packages->pyduino folder. and whenever I import pyduino module in my code it gave an error of unidentified pyduino module.Should I need to do some other things?
2. Also sometimes I am able to import the pyduino module , but then if I command
a=pyduino.Arduino(“COM3″)
a.digital[10].set_active(1)
and run it,it gaves an error.
Same happened with analog read command.
I am not sure where I am doing wrong , Please guide me.
Thank you.
Balau
2011/10/22
I’m sorry but it’s difficult for me to guide you on something that I haven’t done.
When you say “sometimes I am able to import the pyduino module” it is really strange. Try to understand what’s different when you are able to import and when you don’t.
Also, when your program gives you an error, try to read the error message and search for it, it should give more information and maybe a solution.
Try also to run the “Firmata Test” program to see if the problem is in python or on the Arduino: http://firmata.org/wiki/Main_Page