PDA

View Full Version : Throttle input from bicycle crank



Biz
03-03-2008, 02:56 AM
How do I get throttle input from a bicycle crank? I am trying to create a human-powered airplane simulator with Microsoft Flight Simulator 9.

In other words, the pilot must pedal a stationary bicycle, a sensor measures the RPMs of the wheel, and those RPMs must be sent to Flight Simulator to adjust the throttle. If the pilot pedals faster and faster, the throttle will increase.

I don't know where to begin with the coding in FS9, nor how to get this to work. Does anyone have any suggestions?

AndyT
03-03-2008, 03:02 AM
From 0 to 5 RPM is 5% throttle, 6-10 is 10%...
Have the sensor feed into a small PC, Notebook or something and then have the software in it do the translation to FSUIPC.

Michael Carter
03-03-2008, 03:20 AM
Fred Flintstone might know.

He and Barney did a lot of pedaling in the Flintmobile.

If you're for real, I'd really like to see this while shooting an approach to Innsbruck in bad weather. Please put this on U-Tube!

spitfire9
03-03-2008, 03:28 AM
Could a person get a rotary encoder to act as a throttle?

Something like,, every pulse would give 10% power ? Four pulses within say .5 sec. would give 50% power,,, 10 pulses every .5 sec would give 80% power,, etc ???

I wonder if that could be set with Fsuipc ?

Biz
03-03-2008, 03:35 AM
How do I edit it the lines of code for input in FSUIPC? What lines of code that dictates the throttle in Flight Simulator should I look for? I have the unregistered version of FSUIPC version 3.4.8 installed.

This is for a college project. The last thing I need is users thinking this as a joke. We are building an actual airplane. The simulator is for training the pilot. YouTube videos will follow once I get this thing to work.

AndyT
03-03-2008, 04:10 AM
No need to program FSUIPC.
As I said, use a second PC to do the translation and then send that to FSUIPC.

Serial input on PC2 = X RPM (Or digital input depends on your choice of interface)
If X RPM is within (Z to Y range then Throttle = Speed
Set throttle to Speed
(Look at how a hardware throttle works, just translate the raw data)
Send Throttle info to PC1 with FSUIPC.

Yes, I know its a bit more than this, but this will do it quite nicely.
Program it in BASIC if need be. GWBASIC if you cant handle VB6.

Mike.Powell
03-03-2008, 12:16 PM
Biz,

If you don't already have a sensor on your bike crank, you might consider an optical interrupter. This is a fairly cheap arrangement of an LED and phototransistor. If something is in the gap between the two blocking the light, the output is high. If the LED shines on the phototransistor, the output is low.

If you position the optical interrupter so that the bike crank gear teeth pass though the interrupter's optical path, you get a series of output pulses with a frequency that varies with the crank RPM.

Mouser, Digikey, Jameco, etc. all carry optical interrupters.

A cheap micro controller like a PIC16F648A can accept the pulses from the interrupter and, every 50 msec or so, send a message to the PC serial port. This can be as simple as the pulse count since the last message. The PIC16F648A has internal harware to handling serial communication.

You can find documentation on the PIC16F648A on the Microchip website www.microchip.com (http://www.microchip.com). Look specifically for the PIC16F648A manual and the Mid Range Micro Controller Family manual. They have snippets of sample code.

The easiest way to flash program a PIC micro controller is to use the PICKit2 USB programmer. It's available from the Microchip website. Check under development tools.

A good reference for coding the PC serial port under the Win32 API is "Serial Communications in Win32" by Allen Denver available here: http://msdn2.microsoft.com/en-us/library/ms810467.aspx (If you prefer to work with managed code, there is a serial port object under .NET2.0 and later.)

FSUIPC comes with a great deal of documentation. If you dig through the developer's guide you'll find a "Hello world" sample. This sample extracts data from FS, but getting it running is 90% of the way to pushing data INTO FS. To control the throttle, you have to first find the "offset" for the throttle position. The offset is numerical identifier for the throttle variable. Offsets are listed in the FSUIPC documentation. The documentation also describes the data format of the throttle variable. The documentation is available here: http://www.schiratti.com/dowson.html Look for FSUIPC SDK.

To summarize, you will have to develop a small program that receives data through the serial port, interprets that data and scales it to a throttle value, formats the data as required by FS, passes it to FSUIPC, then tells FSUIPC to write the data to FS.

BTW, FSUIPC is not a necessity. If you use MSFSX, you can use SimConnect, an API that ships with the deluxe version of FSX.

Jim NZ
03-03-2008, 04:02 PM
Aaaaahh Sounds like a mission for a kiwi ,,,,

Fit a bike dynamo to the bike (normally they are 6 volt for the bike lights)
Get a few resistors, a pot, a couple of capacitors and if you really want to be fussy,, also get a 5 volt zener diode.
If the dynamo is AC (some are) then you will need a diode as well.

Configure the above so at MAXIMUM pedalling the output is 5 volts.
You may have to apply some filtering.
You will probably have to have some load on the output of the dynamo ,, (A bike light)

Get a joystick ,, check that while it is plugged in there is 5 volts across a pot ,, unwire the wire that goes to the pots wiper and also the one that goes to the - of the pot,,, fit a 100k resistor between them ,, now join the + wire from the dynamo to the wire that was from the slider and the - wire to the frame of the bike. (or the - of the dynamo if it comes out seperate)

Calabrate the joystick etc in windows and set its assignment in FS2004 (or FSX) to be used as the throttle.

No need for FSUIPC or any "external" programming at all. !!!

Start pedalling !!!

Jim NZ

Bob Reed
03-03-2008, 04:47 PM
How do I edit it the lines of code for input in FSUIPC? What lines of code that dictates the throttle in Flight Simulator should I look for? I have the unregistered version of FSUIPC version 3.4.8 installed.

This is for a college project. The last thing I need is users thinking this as a joke. We are building an actual airplane. The simulator is for training the pilot. YouTube videos will follow once I get this thing to work.

Also if you are going to use FSUIPC you will need the registered version.

Mike.Powell
03-03-2008, 05:21 PM
Jim NZ,

I could point out that your solution is far too simple and elegant for a university project, but that would just be jealousy speaking.

Great idea!

Jim NZ
03-03-2008, 08:19 PM
A coil of No.8 fencing wire and a 2 lb hammer used to be standard issue over here on joining Uni !!! Extra credits for "making do" (Saves on over sea's funds.) I unfortunately got bought up in this envirnment !

Of course if the "modern" way is chosen, then there is no need to buy FSUIPC ,,, there is an alternative called FSconnect which, for FS2004, does mostly the same job (I checked and it does do input throttle positions) And its FREE !!!
Check it out here http://www.dirks-software.ca (at the bottom of the page)
No good for FSX though.

Now I AM embarrased. Junk, free, make-do,,, ???? Yep, sound like me.
Now if only I could make the car run without petrol ??

Jim NZ

AndyT
03-04-2008, 03:58 AM
Making the car run without gas is the easy part. I just need the parts to get it done.

ansar
03-19-2015, 10:28 AM
Hey buddy,

I am about to start a project based on what you said. But I need some information. Did you complete that task" Throttle input from bicycle crank?

Please I really need your help....

\
Ansar

ansar
03-19-2015, 10:30 AM
How do I edit it the lines of code for input in FSUIPC? What lines of code that dictates the throttle in Flight Simulator should I look for? I have the unregistered version of FSUIPC version 3.4.8 installed.

This is for a college project. The last thing I need is users thinking this as a joke. We are building an actual airplane. The simulator is for training the pilot. YouTube videos will follow once I get this thing to work.



I need some information about this dude? Will you help to solve how to control throttle input by bicycle crank?