laberning / openrowingmonitor

A free and open source performance monitor for rowing machines
https://laberning.github.io/openrowingmonitor
GNU General Public License v3.0
98 stars 19 forks source link

Signal not being picked up #102

Open igna92ts opened 1 year ago

igna92ts commented 1 year ago

Im trying to hook up my rowing machine sensors but im having trouble getting to pick up the signal. Now this may be entirely my fault (and probably is) My problem is I don't quite understand how the sensors on my machine would work. The connection to where im assuming the sensors are looks like this

image and the cables coming out of it that go into the monitor that came with the machine look like this image So two cables go into each, what it looks like, a headphone plug and jack? My understanding of electronics and electrics is almost none so I don't get how this would work as the library just expects a connection on gpio 17 but I would have 4 cables total coming out of the thing so im guessing 2 ground and 2 signals?.

What I tried is hooking it up with something like this image And the one of those to gpio 17 and the other to GND.

Sorry for the ignorance so feel free to close the issue if it's too much to answer.

JaapvanEkris commented 1 year ago

Could be that they try to detect direction, and thus need two magnets. If that is the case, you can easily ignore one, The selected sensor then should be connected to the GND and pin 17.

igna92ts commented 1 year ago

I tried doing that but it doesn't seem to work. The monitor that came with the machine works fine so im guessing it is generating some kind of signal but I don't really know what to try

exonight commented 1 year ago

I had a similar problem when I set up mine, the original worked but my modification did not. Adding a tiny magnet to the original fixed my problem without permanent changes.

It might be worth a try

Screenshot_20221225_143352_Photos

On Sun, Dec 25, 2022, 14:11 igna92ts @.***> wrote:

I tried doing that but it doesn't seem to work. The monitor that came with the machine works fine so im guessing it is generating some kind of signal but I don't really know what top try

— Reply to this email directly, view it on GitHub https://github.com/laberning/openrowingmonitor/issues/102#issuecomment-1364636954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSSVIC2MIYUDRRENDGUBTWO7XRRANCNFSM6AAAAAATIOCTPU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

igna92ts commented 1 year ago

I had a similar problem when I set up mine, the original worked but my modification did not. Adding a tiny magnet to the original fixed my problem without permanent changes. It might be worth a try Screenshot_20221225_143352_Photos On Sun, Dec 25, 2022, 14:11 igna92ts @.> wrote: I tried doing that but it doesn't seem to work. The monitor that came with the machine works fine so im guessing it is generating some kind of signal but I don't really know what top try — Reply to this email directly, view it on GitHub <#102 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSSVIC2MIYUDRRENDGUBTWO7XRRANCNFSM6AAAAAATIOCTPU . You are receiving this because you are subscribed to this thread.Message ID: @.>

When you say the original worked but my modification did not. do you mean the original being your monitor that came with the rowing machine and my modification being the connection to the raspberry?

exonight commented 1 year ago

Good question lol. My original rowing readout worked, but the same sensor produced bad results with open row. The magnet I added didn't break the original readout while fixing all the sensor problems I was having with open row.

igna92ts commented 1 year ago

I think its worth a try. Ill give it a go and come back with the results. So you just sticked it on it where im guessing the magnets from the sensor pass? Does positioning matter at all?

Abasz commented 1 year ago

Thanks for posting this question. Generally we had two discussions on the two reed switch topics: https://github.com/laberning/openrowingmonitor/discussions/98 and https://github.com/laberning/openrowingmonitor/discussions/95

Tldr: Generally the way a two reed monitor works is by detecting the rotation of the handle bar sprocket spindle. Basically it detects the passing magnet and determines the direction (drive vs. recovery) by checking which reed is triggered first (i.e. the direction of the rotation of the spindle).

Stats on these monitors are calculated from the stroke rate, basically they multiply the stroke rate with a random magic number to get distance and speed and other derived metric.

I recommend trying the v1beta branch and set the auto drag factor to false (so basically ORM only counts pulses).

You need only one sensor, so connect one wire to gnd on the pi the other to pin17. Please make sure that you check the pin out reference (i.e. that you connected to the right pin. I recommend enabling debug logging for the rowing engine for initial setup so you have feedback. In the docs of the v1beta branch there are detailed instructions on the available settings and how initial calibration may be done.

Note that there are certain limitation for such setup in terms of calculated metrics. We went into more details on this in the referred discussions.

Let me know if you have any specific question (also If you have further questions please post the make of the machine so we understand better what we are dealing with)

igna92ts commented 1 year ago

Thanks for the detailed answer. Ill try whats commented on this discussions and come back with the results

igna92ts commented 1 year ago

Thanks for posting this question. Generally we had two discussions on the two reed switch topics: #98 and #95

Tldr: Generally the way a two reed monitor works is by detecting the rotation of the handle bar sprocket spindle. Basically it detects the passing magnet and determines the direction (drive vs. recovery) by checking which reed is triggered first (i.e. the direction of the rotation of the spindle).

Stats on these monitors are calculated from the stroke rate, basically they multiply the stroke rate with a random magic number to get distance and speed and other derived metric.

I recommend trying the v1beta branch and set the auto drag factor to false (so basically ORM only counts pulses).

You need only one sensor, so connect one wire to gnd on the pi the other to pin17. Please make sure that you check the pin out reference (i.e. that you connected to the right pin. I recommend enabling debug logging for the rowing engine for initial setup so you have feedback. In the docs of the v1beta branch there are detailed instructions on the available settings and how initial calibration may be done.

Note that there are certain limitation for such setup in terms of calculated metrics. We went into more details on this in the referred discussions.

Let me know if you have any specific question (also If you have further questions please post the make of the machine so we understand better what we are dealing with)

I tried what you commented but sadly im still not getting anything. Sadly I don't have the tooling to check the signals and see what im actually getting. Im guessing it could be the case that the signals are not strong enough for the raspberry?

If it helps for anything, this is the rower im using https://sunnyhealthfitness.com/products/phantom-hydro-water-rowing-machine-sf-rw5910

I tried to find some info on the monitor/sensor but I couldnt really find anything that seemed useful.

Btw what I added on my config was this,

image

But was I supposed to add it like this or to combine it with the default config?

Abasz commented 1 year ago

https://github.com/laberning/openrowingmonitor/blob/v1beta/docs/rower_settings.md

The config is fine separately. The above link is a detailed explanation of the settings available. In the logging section please try adding RowingEngine: 'debug' as well.

Edit:

I just noticed where you added the adjust drag factor settings. Please have a look at the example config: https://github.com/laberning/openrowingmonitor/blob/v1beta/install/config.js on how to set it in the config.js

igna92ts commented 1 year ago

Sadly still not picking up anything. I think I'll have to buy something for measurement to check that at least I'm getting some sort of signal. I'm assuming my cables work since I just bought them but they may not. The cables from the machine are probably not the problem since my monitor that came with the machine work fine. Just in case you want to see what I actually did here is a pic I case I did something stupid. IMG_20221226_224009.jpg

Don't judge my setup, once it works ill probably clean it up somehow

Abasz commented 1 year ago

Just a quick check: when You plug gpio 17, are you using the 17th pin or the pin labeled gpio 17 (that is actually the 11th pin:) the later should be. Actually gnd and gpio 17 are next to each other (though there are quite a few gnd on the pi)

Just asking as the 17th pin is actually a 3.3v out not a gpio:)

https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

Edit To measure signal a multimeter should suffice:) but you can do it with a battery and a small LED as well, since the reed switch is essentially a physical switch that is turned on by the proximity of a magnet.

Edit2 Also I think you might need to enable the gpio on pi in the software settings in some cases. Has that been done?

igna92ts commented 1 year ago

Im using the 11 and 39, which I think are gpio 17 and one of the gnd. One thing that caught my attention is that when running raspi-gpio get 17 I get GPIO 17: level=1 fsel=0 func=INPUT but shouldn't I be getting something like GPIO 17: level=1 fsel=0 func=INPUT pull=UP ?? Or does that not matter at all? Im trying to look up what I can but I couldn't find wether it means the resistor is setup or not.

Just in case I do have this in my /boot/config.txt

gpio=17=pu,ip
Abasz commented 1 year ago

You are correct, you should get: GPIO 17: level=1 fsel=0 func=INPUT pull=UP

Without the pull-up the pin is just floating, if you have a resistor at hand you can try to connect that to one of the 3.3v pins to create a hardware pullup. I am not sure why the pull-up is not set properly... on mine after the reboot following the changing the config worked fine.

Abasz commented 1 year ago

Yes, so if you issue raspi-gpio set 17 pu then you issue raspi-gpio get 17 you should get: GPIO 17: level=1 fsel=0 func=INPUT pull=UP

igna92ts commented 1 year ago

Mmm when setting the pin to no pull it starts counting random calories on the monitor and when I set it to pu again it stops so im guessing it is actually working. Then im not sure what stopping it from receiving the signal from the cable. Could it be that it's too weak? I guess Ill need to get a multimeter

Abasz commented 1 year ago

It is highly unlikely that the signal is too week as the voltage (3.3) is coming from the Pi, and this is the range the Pi detects changes. So what we should do is check if signal is indeed not being detected by Pi or ORM does not process it.

Please go to the GpioTimerService.js file and find the line that starts: sensor.on('alert', (level, currentTick) => { and change it to the following (basically we are adding two log statements:

  sensor.on('alert', (level, currentTick) => {
    log.info('Tick detected', currentTick)
    if ((triggeredFlank === 'Both') || (triggeredFlank === 'Down' && level === 0) || (triggeredFlank === 'Up' && level === 1)) {
      const currentDt = ((currentTick >> 0) - (previousTick >> 0)) / 1e6
      previousTick = currentTick
      log.info('Sending mesg', currentTick)
      process.send(currentDt)
    }
  })

Also please provide your config.js file so I can test it as well as the start up log in debug mode.

sean808080 commented 1 year ago

@igna92ts were you able to get this working? I have the same rower you do and had little trouble getting the app working with the sensor I bought.
There was even a spot to mount the sensor present on this rower.

sean808080 commented 1 year ago

Yes, so if you issue raspi-gpio set 17 pu then you issue raspi-gpio get 17 you should get: GPIO 17: level=1 fsel=0 func=INPUT pull=UP

This is all new to me but interestingly when I issue that command I do not get pull=UP I get: GPIO 17: level=1 fsel=0 func=INPUT I confirmed it is enabled in /boot/config.txt

# configure GPIO 17 as input and enable the pull-up resistor for Open Rowing Monitor
gpio=17=pu,ip

ORM does work so not sure what to think....

crashbandicode commented 4 months ago

Hey I know it's been like a year but I have the same rower as you and am able to get a signal. I would like to know how to make the graphs in excel though since I'm not completely sure what the axis are. An example xls file would be helpful. Could someone explain or share the excel file? Here is my setup:

Make sure that your cord is connected well. When I setup my crimps I was concerned about the quality of the connection. The default settings from the fork appropriately detects the strokes though I'm not sure on the power. I hope this helps and feel free to ask questions on setup and I'll do my best to help.

EDIT:

so far these settings for config.js seem to be giving really good numbers. I will continue tweaking to reduce bounce but stroke detection so far is almost perfect and the calculated metrics like power and distance seem to be really close to what I was seeing on a gym's concept 2 rower:

export default {
    // example: change the default log level:
    loglevel: {
      default: 'debug',
      RowingEngine: 'debug'
    },
    createRawDataFiles: true,
    //gpioMinimumPulseLength: 150,
    rowerSettings: Object.assign(rowerProfiles.DEFAULT, {
      autoAdjustRecoverySlope: true,
      minumumRecoverySlope: 0,
      minimumRecoveryTime: .2,
      flankLength: 3,
      autoAdjustDragFactor: true,
      sprocketRadius: 6.75,
      maximumTimeBetweenImpulses: .75,
    })

}
crashbandicode commented 4 months ago

Figured out the graph. Turned out I was using the wrong csv. I needed the raw csv uncompressed. Silly mistake.