Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: reading a fuel gauge on: February 12, 2013, 10:29:35 pm
hi MaJiG!
First of all, thanks for the effort, no matter what, you spent your time helping me, and for free, so thanks.
Just for the record, i did put the 12v through the rheostat, and i could hear the fuel "boiling"(?), that's when i decided to post a question, before i blow myself up.
Well, at first, i was surprised ( i'm still a newb, so everything looks like rocket science to me) of the first post, i had no idea that it could be done that way, i was going to leave it until the weekend, and then use a whole day to build it(maybe more than a day).
Now the other post just makes me want to go outside and test it right now(it's 1am here :-) )This is something i can do(probably) and if not right now(depends on resistor values at hand), i'll be testing and posting results tomorrow.
To give more context, this i going to be on a 3.2" touch display. I've totally removed the dashboard, and i'm placing gauges and indicators one by one. I'll post a picture or video after adding the fuel gauge.
2  Using Arduino / General Electronics / reading a fuel gauge on: February 12, 2013, 12:39:43 am
hi everyone,
I know almost nothing about electronics,  but I'm trying to learn.
I need your guidance on this one, because it's still out of my understanding.
As my very first project, I'm doing a motorcycle dashboard, including the speedometer and the fuel indicator amongst other things.
if i'm not wrong, the fuel gauge, it is a variable resistance, that I should be able to read with analogRead. the problem is that, knowing nothing about electronics, i'm afraid I might blow up my Mega(and here in Argentina it's not easy to replace it).
Trying to read the value of the resistance using a tester(please correct me if it's not the right name) ,it says 9,8 ohms at almost full (again, i might be wrong).  So, before plugging the arduino pins to this, I tried plugging 5v at one end, and a voltage tester at the other end, to read how much of the 5v gets trough the variable resistance. Something went wrong, because the power source turned off, like if there is a short circuit (wich is probably what happened) . I'm using a branded cellphone car charger as power, since it seems quite good at converting 12v from the motorcycle battery,  to the 5v needed for the usb, and the label reads 800mah.
My question is how could i safely read this, without killing my board? is 10 ohm a very low value for a fuel indicator? Googling other projects, they had higher values, am i reading wrong? my idea is to apply 5v trough this, and read the analog value on the other end, to get an approximate of the remaining fuel.
I can add more detail if something it's not clear, but that's the idea.
Please excuse my poor english, and thanks in advance for reading.
Marcos
3  Using Arduino / Sensors / Re: Measuring speed of a motorbike wheel on: August 15, 2012, 10:54:55 am
Hi aeronaut!
Thanks for the wheel  tip, i've measured it while standing on the air, so, yes i think i'm getting a small error. I'll measure again with your method, and check results.  smiley
I'm a newbie to electronics, not only arduino, so replacing the Mega's chip is totally out of my league. Plus, the value of the chip in my country, makes it cheaper to replace the whole board  smiley-confuse
I woul'd ve started with an arduino uno, but i didn't tell you about the "other" stuff  smiley
The final idea is to fully replace my motorbike's panel, this includes speedometer, partial and total odometer(is that a word?), tach, fuel indicator, hi-low lights indicator and turn lights. In addition to this, seeing other motorbikes useful stuff, i'm adding those ideas to my project: Remote engine start, smart choke control (warming up), pc communication, and (in a million years) adaptable bodywork (move the plastics according to bike speed).
I wanted to use a nice and big display, and i found one of the itead's display shields with touch and SD card slot (3.2") to be big enough (for now, it's a bit slow).
All of this seems easier with a Mega, wich has more in/out pins and interrupts available.
I know it's a lot of work, and probably totally useless, but hey, it will be fun!
Any idea is always welcome!
4  Using Arduino / Sensors / Re: Measuring speed of a motorbike wheel on: August 09, 2012, 02:23:02 pm
hi everyone, thanks for the examples and guidance, i've finally managed to make it work!  smiley I started from scratch, with another approach as suggested.
But being a noob, a loose wire apparently fried up my mega, sending current through an output pin , it's now unable to communicate with a pc, so i can't upload new sketches, it keeps being detected as an unknown device.   smiley-cry  (tried different usb cables and computers)
I'm now trying to design a pcb to protect the inputs and outputs via optocouplers (and placing wires really really away from the arduino)while a new mega arrives.
Thanks to everyone for the support, i'll open a new post (with pictures!) when i get the new board, to show what's done  smiley-wink
5  Using Arduino / Sensors / Re: Measuring speed of a motorbike wheel on: July 30, 2012, 03:49:39 pm
Oh, sorry, i was trying to simplify, since the original code contains more stuff outside the part shown.
The variables inside the loop are:
Code:
  long int cuantos  = 0;
  long velocidad  = 0;
  long contador = 0;
  long ultima_vez = 0;
  unsigned long  promedio = 0;
  boolean igual = true;
  unsigned long verificacion[3];
  int i = 0;

And the ISR variables are declared like:
Code:
volatile unsigned long ultimo = 0;
volatile unsigned long tiempos[3];
volatile int  puntero = 0;
volatile float m_totales   = 0;

I read somewhere (tutorial maybe) that ISR variables should be volatile, not sure why, but i did it, just in case.
The ISR routine is not too long? Not sure if that's ok....
Also, could it be that an interrupt calls just when the arduino is writing to the LCD, and some random lines appear? Once in a while this happens, a few green or white lines are drawed, but behaviour remains the same....
Another thing i don't understand, is that if i should enable the internal pull-up resistors or not, in this case it's enabled:
Code:
  pinMode(18, INPUT);  //Velocimetro  (PIN 18 para el interrupt)
  pinMode(18,HIGH);   // Internal pull up resistor(?)
The (presumed) hall sensor goes to arduinos +5v and pin 18, wich should be interrupt 5, and the pin 18 input is tied to ground via a resistor (3.9 Kohms )
Any suspects?  smiley-confuse
6  Using Arduino / Sensors / Re: Measuring speed of a motorbike wheel on: July 30, 2012, 11:16:44 am
Hi again,
I am trying to implement that solution, but there must be something (again) i'm missing.
First of all, the code:
In the setup:
Code:
  attachInterrupt(5, contar, RISING);
The interrupt routine:
Code:
void contar()
{
  //Count only if pulses are at least 40 ms from each other...
  if ( (millis() - ultimo )  > 40)
  {
    tiempos[puntero] = millis() - ultimo; //Save the difference in an array
    puntero++;                            //advance the array pointer
    if ( puntero == 4 )                   //don't fall from the array!
      puntero = 0;
    m_totales += 1.88;                    //count total distance
    ultimo = millis();                    //remember when this pulse happened
  }
}

Then, the processing loop (a loop inside the main loop, because of the menu):

Code:
while( !myTouch.dataAvailable())  //Repeat until there is a touch on the screen, anywhere...
  {
    if ( ( millis() - ultima_vez) > 500 )  //refresh every 500 ms
    {
      //Check if nothing changed since last time...
      igual = true;   //turn on flag...
     
      for (i = 0; i<4 ; i++)
        if ( verificacion[i] != tiempos[i] )
          igual = false;                //Something has changed
      if (igual)                        //If nothing has changed
        for (i = 0; i<4 ; i++)          //empty everything
          tiempos[i] = 0;
      promedio = 0;                     //clean average time..
     
      if (!igual)                       //Only calculate average if there is something to calculate
        for (i = 0 ; i<4 ; i++)
        {
          promedio = promedio + tiempos[i]; 
          if ( tiempos[i] != 0)         //sum up every non-zero item
            contador++;               
        }   

      if ( promedio != 0)
      {       
        promedio = promedio / contador;
        //           1 hour   wheel   average     km
        promedio = 3600000UL * 1.88 /  promedio / 1000 ;
      }                 
      myGLCD.printNumI(promedio, 10 , 140,3,'0');  //Write the calculated speed
      for (i = 0 ; i<4 ; i++)                      //Additionally
      {                                            //write every measured time
        myGLCD.printNumI(tiempos[i],50,(i*16+40),10,'0');       
      }
      for (i = 0 ; i<4 ; i++)                      //copy everything for the next turn
        verificacion[i] = tiempos[i];           
      ultima_vez = millis();                       //remember time for the next 500ms
    }
  }
I've placed some comments, but the general idea, is to show  4 positions of timings. The four positions in the display, should be the four positions of the array "tiempos". The array "verificacion" it's a general idea to check for changes (when i brake to 0 the bike, it shouldn't be waiting for another wheel turn)
The lcd library is taken from http://www.henningkarlsen.com/electronics/library.php?id=51, and seems to be working fine.
All of this, to get an average speed every 500 ms, counting the average of the array "tiempos".
Code:
promedio = 3600000UL * 1.88 /  promedio / 1000
; is an approach to measure speed, 1.88 is the wheel perimeter ,and i'm trying to show it in KM/H
The behaviour, is that only in the first turns, the positions are filled correctly, but then the first 3 positions are never updated, and the last one begins to show random numbers (i guess are random, because it changes without noticeable pattern, and even some negative numbers appear).
I've tried not clearing the array "tiempos", but didn't change behaviour at all.
Any idea about what could be wrong? Anything helps!
Thanks!

7  Using Arduino / Sensors / Re: Measuring speed of a motorbike wheel on: July 24, 2012, 10:38:08 am
Thanks JavaMan, your idea is just what i need smiley
Doing all the other stuff, i ended up confused and trying to do it the wrong way. smiley-roll-blue
I'll change the code and post results smiley-grin

Again, thanks!!
8  Using Arduino / Sensors / Measuring speed of a motorbike wheel on: July 23, 2012, 01:50:54 pm
Hi everyone,

I'm working on a small project, among sensing other stuff, i'm trying to get the speed of a motorcycle, based on the number of turns of the front wheel.
To do this, i've managed to put my hands on a small bicycle speedometer, chopped the magnet / sensor and connected it to an arduino mega (i believe it's a hall sensor, but who knows, the thing is heavily packed in plastic, with only 2 wires coming out)
The arduino 5+v goes to the sensor, and the input goes to pin 18(wich should be an interrupt if i'm not wrong) and is tied to ground via a 3.9k. Everytime the magnet reaches the sensor, i'm getting an interrupt. So far so good.
I'll try to add more detail:
*/Not necessarily useful stuffRefreshing the speed in the screen every 500 ms sounds great to me, so i'm counting how many times the interrupt gets triggered in that amount of time.
I've measured the wheel circumference, and it's 1.88 meters.
So, let's say i count 3 turns in 500ms, then this should be something like:
3 turns * 1.88 mts = 5.64 mts
If in 500 ms the wheel does 3 turns, then in 3600000(1hour) it would be...21600 turns... based on that, i can assume speed.
/* End of blablahWell, the problem actually is that the wheel circumference is too big, and the speedometer "resolution" is really poor, it jumps from 0 to 13 to 27 to 40, and so on...
I know adding more magnets would give me more accuracy, but i had to debounce the sensor, because it was giving me two readings every time the magnet was passing by.
From some basic(random)  calculations, i've used 50 ms as debouncing. If the last pulse was read at least 50 ms ago, it's counted, if not, i discard it (do nothing).
Adding more magnets means less time between pulses, wich could be impossible to debounce.
Searching different methods, i've found an optic mouse-like sensor.
I'm thinking on using the brake disc to count revolutions, using the small refrigeration holes. But i'll have to deal with interference from the sun, cars headlights, road water. rain,  and lots more...
I've seen rotary encoders, but i'm not sure i can mount that, and price here in my country is a bit too high. Can it be mounted as the old bike generators? (a little wheel spinning with the main wheel) Maybe using one of those little electric engines from toy cars? can it be measured somewhat proportional to the number of turns?
Is there a better method of doing this? It doesn't need to be 1km accurate, but the more, the merrier  smiley-grin
I can add more detail, but might be even more confusing.
Any idea helps!

Thanks in advance!
9  Using Arduino / Project Guidance / Re: Project feasibility: motorcycle hud on: May 30, 2012, 01:53:09 pm
All right, then i'm going to continue tweaking all the sensing stuff, and put it all together on a single arduino.
You've saved me lots of time learning about I2C(and lots of money too  smiley-grin)
After some more significant progress(i'd like to have something to show first) i'll start a thread again with details of what's going on.
Thanks to both of you for taking the time!
10  Using Arduino / Project Guidance / Re: Project feasibility: motorcycle hud on: May 26, 2012, 12:40:05 am
If it helps describing the idea, the display is:
http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=478
I'm building each part, but still don't have the whole thing assembled
11  Using Arduino / Project Guidance / Re: Project feasibility: motorcycle hud on: May 24, 2012, 10:07:40 am
Hi Peter, i've been looking at several options to achieve that, and i think that using a small projector would be the best option. I have a quite large windshield installed on my motorcycle, and projecting useful info on it would be the final idea. First i want everything working on the ITEAD display, and then i'll move on to the projector.
A single Arduino can handle all that data? RPM pulses are going to be quite fast, plus hall sensor's readings, and even more processing with the display(for now) protocol. If not, using multiple arduinos could be a workaround?
The desired effect is a "realtime" measure, or at least close to it, refreshing the data as fast as possible (1 second seems too slow).
Hello Kduin, i love that project, i've seen it but i don't like the idea of wiring myself (maybe bluetooth?), and blocking one of my eyes scares me a bit, but the idea of the retroview camera is awesome, maybe it could be done with an external video processor, to send it to a display(and maybe a projector later)?
I can specify more if needed, just name it.
Thanks a lot!
12  Using Arduino / Project Guidance / Project feasibility: motorcycle hud on: May 23, 2012, 04:00:44 pm
Hi everyone,

I'm making my first post here, but i've been reading and following projects for a while.
I need your advice on a project i'm planning, but first i would like to know if it's actually possible, so i don't end up on a dead end.
The basic idea is to do the classic rpm-meter-on-a-bike project, along with speedometer and a few extras, but nothing you haven't seen on the forums so far.
My real question is if the arduino (mega, uno or nano) can handle such amount of data input and display it, all at the same time. To add some info, i've seen and tested some hall effect sensors to measure wheel speed, and managed to make it work just fine. I've found also another project here on the forums to read RPM from the engine spark with a capacitive clamp, and seems a good idea so far (still working on it, can't get all the pieces yet). Also, i've got one of the itead displays, ITDB02 3.2", to display everything. The display covers all of the mega pins, but doesn't use them all, so i could manage to use some pins.
From an old bicycle speedometer i've recycled the hall sensor and the magnet, attaching them to the front wheel, and managed to count each wheel turn (up to 35 ms each, at max speed).
Some quick calculations tell me that at 9000 rpm from the engine (max, it's a small one, single cylinder, single spark), i would have to read a pulse each 7ms (rounding up, and it's a four stroke so it would be like 28ms for every "cycle", right?).
The problem i think i'll have when i try to assemble everything, is that arduino is working at 16mhz, and there is too much info to handle at the same time, adding the LCD protocol.
Maybe if i use an arduino nano to read RPM, another arduino nano to read speed (from hall sensor) and another arduino mega to manage and display everything i could get enough time to display info on the screen accurately enough?
Coordinating everything via I2C to get data from each nano is a good idea?
I'm not sure if i will get enough "processing speed" to refresh the screen a few times per second (a portion of the screen actually, i've read the display is quite slow too  smiley-sad )
Any advice would be more than helpful, and please excuse my weird english.
Thanks!
Pages: [1]