Go Down

Topic: Arduino Android bike computer (Read 2545 times) previous topic - next topic

Deus_Ex_Machina

Hello everyone,

I have decided to pursue the following project:

I want to implement the following controller using an Arduino Nano, that I bought

https://github.com/jenkie/Arduino-Pedelec-Controller
http://www.pedelecforum.de/wiki/doku.php?id=elektrotechnik:forumscontroller#downloads

Instead of the Nokia 5110 display most people are using, I would like to use a water resistant Android device.
This would have various advantages over using the Nokia display or other displays available for the Arduino, the most important being that no nice looking waterproof cases are available for the price it would cost to buy used Android phone like the Motorola Defy.

The biggest problem is, that I have zero programming experience. I have a very good idea, of what I want to accomplish.
In a first step the Android device is only supposed to do readouts from data the Arduino produces.
I would prefer to use a USB connection, but if you think bluetooth is easier, I will go for that.

This is, what I would like the app to look like:


I would like to start with readouts from temperature, voltage and current sensosors and the reed switch from the the bike's speed sensor.

I am in need of a lot of guidance, where to begin and what to learn.
There is already code available for the readouts of the sensors. The key task is to somehow make the connection between the Arduino Nano and the Android device and getting it to display the information in the right way.

I would then like to increase the amount of sensory readouts the phone can handle and make the individual fields modular with options to cycle through for each of them.
Then I would like to implement throttle control for the bike's electric motor and a cruise control.

Any advice and guidance on how to pursue this project would be greatly appreciated.

strykeroz

Hi

Since the Android device will need to run some kind of app to know how to talk to your sensors (via the Arduino) then it's possible you can get through this with Bluetooth (say) and something you create using one of the free online app writers for Android, for example the MIT App Inventor.

I'd certainly start looking in that direction for the front-end part of it.  What you do at the Android end will largely determine what communications you need to provide from your Arduino.

Cheers ! Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Deus_Ex_Machina

Greetings to the other side of the world ;-)

The link seems to be a platform, where you can store apps you're designing, but it doesn't really help me, in getting started :-(

strykeroz


The link seems to be a platform, where you can store apps you're designing, but it doesn't really help me, in getting started :-(
Yes it's a place where you can write simple apps for Android, then load them onto a device.  Unfortunately (or fortunately) by choosing an Android device as your display you're going to have to learn how to program both the Arduino and Android ends of your project.  Using the Nokia display your Arduino will be talking directly to the electronics of the screen - using Android you're asking it to communicate with another computer so it's a little more involved.

Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Deus_Ex_Machina

Sure, I get that.

Most of the Arduino stuff is done already.
If you look at the github page and the wiki I provided, you'll see that almost everything on the arduino has been done already.
So I have to learn how to adapt it to Android and get the readouts there.

Could you maybe help me with the first little task of reading one "DS18B20 Digital Thermometer +/- 0,5 °C TO92 1-wire" and getting the temperature displayed via USB on my computer.
Maybe that'll help me gain some basic understanding of how to take readings and display them. I have attached the sensor to the controller board as desribed in the wiki on J4, which means A3 has the signal from the sensor.



strykeroz


Could you maybe help me with the first little task of reading one "DS18B20 Digital Thermometer +/- 0,5 °C TO92 1-wire" and getting the temperature displayed via USB on my computer.
Maybe that'll help me gain some basic understanding of how to take readings and display them. I have attached the sensor to the controller board as desribed in the wiki on J4, which means A3 has the signal from the sensor.
Hi

As per the wiki article, J4 is an analog connection.  That would be appropriate for something like TMP36, LM335 or LM35DZ temperature sensors - you can read up more on how they're used in this article at Adafruit.

The DS18B20 is a digital sensor, using the one wire bus so you won't get a reading out of it connected that way.

Have a read of how the One Wire bus works and you'll have more success.  One of the examples on that playground page link above will also output the temperature reading to the Arduino serial monitor on your PC over USB.

All the best, Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

jerseyguy1996

For programming the android I would start with this:
http://www.youtube.com/course?list=ECB03EA9545DD188C3&feature=plcp

It brought me up to speed pretty quickly.  Just work your way through all of the videos.  Don't just watch the video.....actually work right along with him on your own system duplicating everything that he does.
Arduino Uno;
Mega328

Deus_Ex_Machina

Thanks a lot. I will take a look tomorrow :-)

Deus_Ex_Machina



Could you maybe help me with the first little task of reading one "DS18B20 Digital Thermometer +/- 0,5 °C TO92 1-wire" and getting the temperature displayed via USB on my computer.
Maybe that'll help me gain some basic understanding of how to take readings and display them. I have attached the sensor to the controller board as desribed in the wiki on J4, which means A3 has the signal from the sensor.
Hi

As per the wiki article, J4 is an analog connection.  That would be appropriate for something like TMP36, LM335 or LM35DZ temperature sensors - you can read up more on how they're used in this article at Adafruit.

The DS18B20 is a digital sensor, using the one wire bus so you won't get a reading out of it connected that way.

Have a read of how the One Wire bus works and you'll have more success.  One of the examples on that playground page link above will also output the temperature reading to the Arduino serial monitor on your PC over USB.

All the best, Geoff


Why do you think the pin being a analog one is a problem?
The way I understand it, all Arduino pins can be used as digital in/outputs and some can additionnally be used as analogue ones.

GoForSmoke

All the I/O pins work for digital I/O. Even reset function can be turned off to get an I/O.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

strykeroz

#10
Oct 27, 2012, 11:17 pm Last Edit: Oct 27, 2012, 11:21 pm by strykeroz Reason: 1

Why do you think the pin being a analog one is a problem?
The way I understand it, all Arduino pins can be used as digital in/outputs and some can additionnally be used as analogue ones.
That is entirely true.  However what I was calling out is a reason yours might not be working as that is a fundamentally different temperature sensor which also needs the resistor to setup the one wire bus.  

If you connect it and try to talk to it with the same code it will not work. It's not an Arduino issue.

Apologies for the confusion, Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Go Up