advice please....

Hi Everyone.

Mid way through a project at moment for local charity. Its a push bike on a training stand with a electric motor connected up to the stand. This in turn is connected up to my arduino uno which then outputs a numerical value (volts) onto a large 5" LED 3 segment display.

Have had a few issues around getting the segments to work then the bike melted some wires when peddled and now can’t get the display to work, which is was when we melted the wires…

I wanted to have this as a fun thing for people to play at a festival.

The faster you peddle the more volts you produce, which in turn displays the volts onto the display. the higher the volts the tiger you go on our top gear leader board… all just for fun.

am I fighting a loosing battle in what I want to do… Have put to much money into this now for me to walk away.

The code I have been using is as follows:

/

//GPIO declarations
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
byte segmentClock = 6;
byte segmentLatch = 5;
byte segmentData = 7;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void setup()
{
 Serial.begin(9600); // SETUP
 Serial.println("Large Digit Driver Example");

 pinMode(segmentClock, OUTPUT);
 pinMode(segmentData, OUTPUT);
 pinMode(segmentLatch, OUTPUT);

 digitalWrite(segmentClock, LOW);
 digitalWrite(segmentData, LOW);
 digitalWrite(segmentLatch, LOW);
}

int number = 0; //Reset display to zero

void loop() {
 showNumber(number); //Test pattern (does zero show after reset?)
 // read the input on analog pin 1:
 int sensorValue = analogRead(A1); // CHANGE INPUT PIN HERE
 // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
 float voltage = sensorValue * (5.0 / 1023.0);
 float actualVoltage = voltage * 46.5; //multiply to negate resistor divider
 // print out the value you read:
 Serial.println(actualVoltage);

 
 if (number > actualVoltage) {
   number = actualVoltage;
 }
}


//Takes a number and displays 3 numbers. Displays absolute value (no negatives)
void showNumber(float value)
{
 int number = abs(value); //Remove negative signs and any decimals

 //Serial.print("number: ");
 //Serial.println(number);

 for (byte x = 0 ; x < 3 ; x++)
 {
   int remainder = number % 10;

   postNumber(remainder, false);

   number /= 10;
 }

 //Latch the current segment data
 digitalWrite(segmentLatch, LOW);
 digitalWrite(segmentLatch, HIGH); //Register moves storage register on the rising edge of RCK
}

//Given a number, or '-', shifts it out to the display
void postNumber(byte number, boolean decimal)
{
 //    -  A
 //   / / F/B
 //    -  G
 //   / / E/C
 //    -. D/DP

#define a  1<<0
#define b  1<<6
#define c  1<<5
#define d  1<<4
#define e  1<<3
#define f  1<<1
#define g  1<<2
#define dp 1<<7

 byte segments;

 switch (number)
 {
   case 1: segments = b | c; break;
   case 2: segments = a | b | d | e | g; break;
   case 3: segments = a | b | c | d | g; break;
   case 4: segments = f | g | b | c; break;
   case 5: segments = a | f | g | c | d; break;
   case 6: segments = a | f | g | e | c | d; break;
   case 7: segments = a | b | c; break;
   case 8: segments = a | b | c | d | e | f | g; break;
   case 9: segments = a | b | c | d | f | g; break;
   case 0: segments = a | b | c | d | e | f; break;
   case ' ': segments = 0; break;
   case 'c': segments = g | e | d; break;
   case '-': segments = g; break;
 }

 if (decimal) segments |= dp;

 //Clock these bits out to the drivers
 for (byte x = 0 ; x < 8 ; x++)
 {
   digitalWrite(segmentClock, LOW);
   digitalWrite(segmentData, segments & 1 << (7 - x));
   digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
 }
}

Advice or suggestions or instructions would all be gratefully accepted.

Many Thanks
Gary

If I'm understanding the situation correctly . . . .

I don't think you can fix melted hardware by changing anything in the software

The faster you peddle

I want nothing to do with anything drugs-related.

Please use code tags when posting code.

I can't tell what your wiring is, but clearly you have a generator powered by a bike, and the voltage from the generator is variable. And what is its top value? And have you tried feeding that voltage directly to an analog pin on the Arduino? And does the generator put out AC or DC? And do you have a common ground for the generator and the Arduino?

Properly done, if this is an AC generator, you need to convert the output to DC, using a half-wave or full-wave rectifier followed by a capacitor. If its a DC generator, you still need a capacitor (say 1000uf) to smooth out the output. Then you should measure the top DC voltage with a voltmeter, assuming a very strong rider. Add at least 50% to that, in case a Tour de France rider shows up. Now you must be sure you have a common ground between your DC voltage from the bike and the Arduino, then be sure that you use a voltage divider which will assure that you don't exceed 5 v. on the analog pin to the Arduino.

As for the melted wires and the nonfunctional display, chances are it's destroyed. I'm surprised the Arduino isn't destroyed.

Have you got a load on the generator - for example a lamp - to absorb the power that the rider produces. If so please give details.

If not the generated voltage can get very large and cause damage.

Melted wires imply that the current was too high for the wires to carry.

Have you a multimeter that can measure the current (amps) produced by the generator? If so, what is the maximum that a fit rider can produce?

...R

Not sure what this electric motor is. It's a pedal bike. Maybe you mean there's some kind of sensor? Or is it actually some kind of literal generator that is actually producing electricity from the bike?

If your goal is just to have a readout, I would probably just use a simple sensor on the wheel, either optical or inductive, to read out the wheel rpm. Then just do a little calculating to translate that to theoretical voltage to display. Not sure why it has to be volts, but nonetheless, doing this keeps you from having to deal with generated electricity if it's actually a generator you're talking about.

Hi Everyone.

Sorry for the lack of information. Im a far better cancer support specialist than i am a arduino programmer lol....

Anyway...

the generator is a 24v 380w motor. the highest voltage as per a multi meter was 79volts.(the bike is a very old 5 speed so no chance of getting over 150volts.

I do know my nephew has put bits in place to reduce the voltage down to below 5v for the board. And yes, we did fry a board. Luckily i have a backup or 2......

To be honest Im not to sure why its volts either...... this has been so long in the making I've forgotten... The reading of the speed of the wheel sounds interesting.... what would I be looking for if i changed it all and went down that route.... an MPH readout would be far easier and less chance of frying another board..... Think it was volts as I had the hardware to make that......

No lamp on the system at all......

Cheers Gary

Would this be suitable for the speed sensor? and if so how would I utilise the signal from this into the arduino??

BIKE SPEED SENSOR

Cheers Gary

OK. Done a quick bit of research and can do it with a reed (magnetic) switch. SO thought that this may do

REED SWITCH

Found a guide on instructables. so looks sort of promising that I might have this ready for V festival in 3 weeks....... eek better get moving.....

Cheers Gary

Oh. Any other advice guidance etc very gratefully received.........

Hall-effect sensors don't bounce like reed switches do.

Keep it simple to keep it reliable. Top MPH reached is fine for a scoreboard.

The generator did have the benefit of probably providing some resistance, but if the bike has any gears, you can leave it on the highest one or make the rules clear.

You could even restrict the time window in which to achieve a top speed just to keep things moving and so no one overexerts.

Just go to E-Bay and search for "led proximity sensor tachometer". $10.00 and free shipping. Comes with display,sensor and even the magnet.

detown: Just go to E-Bay and search for "led proximity sensor tachometer". $10.00 and free shipping. Comes with display,sensor and even the magnet.

Nice. But could really do with 5" digits so it can be seen from a distance. looks better too lol. I have already got 3 x 5" digits already wired up and built into a display so was hoping to utilise those...

INTP: If I'm understanding the situation correctly . . . .

I don't think you can fix melted hardware by changing anything in the software

if(oldWire == burnt){ wire = newWire; }

???

Hi, Welcome to the Forum

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit that you had when you fried the wires, in CAD or a picture of a hand drawn circuit in jpg, png?

You have two different wiring setup is the two pictures of your UNO board, what are they?

Thanks.. Tom... :)

first off, take a simple 150 watt lamp and connect it to the motor.
as you peddle the lamp will glow

there are lots of ways to get a DC voltage from your high voltage AC
and lots of ways to just get DC from the bike.

btw, having a lamp willl make it harder to spin the motor.

you can paint a dot on the rim of the bike and use an IR sensor.
you can put on a small 5 v DC motor and as that spins on the tire, it will generate up to 5 volts DC, but expect to do some calculations for speed of OD of the wheel and the motor shaft to determine RPM of the motor.
hall effect has been said.
you can use an simple restive voltage dividers on the AC to get lower voltage, but better to rectify it for a better signal.

essexgary: No lamp on the system at all......

I asked if there was a load on the motor. I just suggested a lamp as a suitable load if you don't have anything else. You have not said whether there is a load!

A load on the motor is absolutely essential.

See also Reply #15 for a supporting opinion.

...R

Hi Everyone.

My mistake re the pics of the Arduino and being 2 separate wiring setups. As for a wiring diagram.. I will try to get something to you all tonight when I get home.

There is no load on the motor/generator at all. Bike on training stand and the motor/generator is hooked up to the stand via a flexible shaft coupler. the wires from the motor/generator then go direct to arduino via a circuit board. then from the arduino via a circuit board it goes to the 3 x 5" digital displays.

As I said. I make an excellent cancer support specialist but a crap programmer/electrician type person. Please forgive my ignorance. A friend suggested I post on here for advice etc. I should of spent a while reading the bits first. Sorry.

Gary

add a regular incandescent lamp. higher wattage is preferred. do not use led's or fluorescents .

connect a voltmeter. see what your maximum voltage is

Will try that tonight hopefully. As long as I can find a lamp holder........lol

dave-in-nj: add a regular incandescent lamp. higher wattage is preferred. do not use led's or fluorescents .

connect a voltmeter. see what your maximum voltage is