Pages: [1] 2   Go Down
Author Topic: Combining analog input  (Read 2267 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Guys,

I'm quiet new to Arduino and electronics and I am trying to build my own speedometer with LED's. Currently I have my LED's up and running. So now its time for phase 2, input  smiley

First this speedometer is for a motorcycle bike and it needs to have to following input:
* Indicator left
* Indicator right
* Fuel Injection Sensor
* Speed sensor (magnetic)
* Temperature sensor (oil heat)

Fuel Injection Sensor
This is a very important step in the process of turning on my engine. I cannot turn on my engine before this sensor calculated how many fuel it needs to burn. Of course the electronics of the bike are turned on in this process.

My problem
Well to be honest 'my mistake'. I did not calculated all the pins and I eventual got stuck with missing 1 analog input. However I think its still beatable!

My indicators can only be turned on one at the time. So its physically impossible that both left and right are turned on at the same time. I want to use this with the Fuel Injection sensor, if both left and right are turned on then this will mean the sensor is calculating how much fuel it needs to burn. If its done calculating then it will turn off both left and right indicator.

The drawing


My question
Since I am quiet a noob and before I buy the components, do anyone see any problems?? Also thanks alot in advance.

Side notes:
Indicators: This input is 12v but I heard it can go up a bit during driving.
Resistors: (12v - 5.7v)/0.04 = 157.5 (closest 150?)
Diodes: Forward Voltage drop will be at 0.7v
« Last Edit: March 02, 2011, 04:28:11 pm by DragoslaV » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 634
Posts: 34563
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
do anyone see any problems
Yes you are connecting 12V into the arduino, you will blow it up.

You need either potential dividers or some sort of transistor to act as a buffer.

Once you take out the Aref none of the other analogue inputs will read anything meaningful.

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 546
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Aside from feeding in 12V, I don't believe Aref is an input you can get readings from, and you seem to be after more digital type inputs.
Seems like its time to add a multiplex chip, or a shift in register that you read continually to see if anything has changed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Grumpy_Mike
Thanks, I was aware that I had to cut down the 12v to 5.7v but I thought that was done differently..  smiley-zipper What is your best practice for that then??

@CrossRoads
I looked a bit closer in the Reference page and yes I totally misunderstood it  smiley-roll-sweat I guess that gives me the problem of missing 2 pins. I also could use a shift register but I want to keep this project as simple possible and also I could drop the temperature sensor which only gives me the headache of how to convert the 12v to a 5.7 and eventually to 5v.
 


@KE7GKP
1) Well I could free up a digital pin by swapping it with a LED column.
2) That is a nice technique too I'm ganna keep that in mind! Thanks for sharing smiley
« Last Edit: March 02, 2011, 07:33:42 pm by DragoslaV » Logged

0
Online Online
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no 'A8' pin!
Logged

[ I won't respond to messages, use the forum please ]

0
Online Online
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you have more analog input devices than analog pins you need to multiplex, see this page: http://www.arduino.cc/playground/Learning/4051
Logged

[ I won't respond to messages, use the forum please ]

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@MarkT
Good noticed, I made a typo; it should be A0, A1 and A2.
Also thank you for the link! I guess a multiplex is the best practice for my problem.

@All & KE7GKP
I'm sorry, I should have posted my entire schematics. smiley-roll-blue

Schematics (without Multiplex)
« Last Edit: March 03, 2011, 08:05:22 am by DragoslaV » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 634
Posts: 34563
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The row pins can only supply 30mA so you will have to split this amongst all the columns. You normally need some form of high sided driver like a p- channel FET or a PNP transistor.

Also the row resistors should be in the columns, otherwise the brightness will change depending on how many LEDs are on at the same time.

How will the software scan these?
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Grumpy_Mike
Yes, spot on, I totally forgot to update my schematics but I have 10 resistors on the columns and not on the 8 rows as shown in the image.
Also somehow I got my LED's working without the transistors and with a very good brightness. (LED's require 20mA). Does it harm anything if I continue without?

@KE7GKP
Haha yes I used all the pins  smiley-roll-blue  I would have done it differently now but I guess that is what learning is all about.. I totally dropped my first idea. That idea was the result of a noob trying to figure out a creative way around smiley-roll-blue

I think your multiplex is a really good idea so I'm gonna update the schematics with a 4051 between it.
« Last Edit: March 03, 2011, 04:04:00 pm by DragoslaV » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 634
Posts: 34563
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If each LED requires 20mA then you are asking those anode pins to supply 200mA. So yes this will do harm seeing as 40mA is the absolute limit.
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That makes sense. I wish somebody told me that here. But I'm glad I you told me this while its still on my breadboard smiley I just dont get it why they didnt mention to put transistors between it in the playground example.  smiley-sweat

So todo for now:
* Add transistor to the rows.
* Add a Multiplex. (4051)
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 634
Posts: 34563
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I just dont get it why they didnt mention to put transistors between it in the playground
Sadly it is not a very good example, you will note there is no resistors in although the text now tells you to do this after some badgering from a few members. The lack of resistors and overwriting of the outputs probably meant the display looked ok. There is a train of thought that goes, it is only a demonstration and people will not run it for long so overload dosn't matter.
However I think that it is important to get it right as people, like you, go on and use the circuit as a basis to expand into their own design. If you start off with the right idea you don't have to relearn old stuff.
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks everybody and thank you Mike for clarifying that out!

Based on your input and based on this schematic, I have created a new schematic for myself including the multiplex and transistors. The transistors used in this schematic is a '2N3904'. Could I also use this for my setup??

Also I would love to hear if I made a(nohter) mistake in my schematics!  smiley-grin


* speedometer.gif (56.49 KB, 1041x1075 - viewed 14 times.)
« Last Edit: March 04, 2011, 09:02:35 pm by DragoslaV » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 546
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The big block labaled transistors represents 6 more of the NPNs above?
You are missing the resistors between the arduino and the base pins as shown in the example you cite.
Need them to limit current out of arduino pin.

You might also look at ULN2803, 8 transistors all packaged up with needed resistors.
High input pin, output pulls LED cathode low.
http://focus.ti.com/lit/ds/symlink/uln2803a.pdf
ULN2803 is 46 cents at dipmicro.com
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, that block should have represented 6 more of the NPNs like above. To be honest the new program I was using is frustrating as hell to work with so I just made it one block  smiley-roll

Also thank you a thousand times for the ULN2803A tip! This will definitely save me time and wires! I'm now off to the store to buy the 4051 and the ULN
« Last Edit: March 05, 2011, 08:30:21 am by DragoslaV » Logged

Pages: [1] 2   Go Up
Jump to: