DIY data collection (with link to working code for Arduino and Bluetooth )

24

Comments

  • Thanks for your work and posting all this! This finally sounds tangible enough to start experimenting with it myself on my Motocross bike!
    Do you have more details on the parts we need for your latest version?
    Engine RPM via capacitive coupling to spark plug wire. --> ~5 loops over the spark plug wire should do?
    Blue Pill (Arduino) STM32F103C8T6, Motion sensor MPU9250, 3x Accel + 3x Gyro (+ 3x Magnetometer), Ublox Neo M8N, JDY-30, DC/DC 12V to 3.3V (from 12V start/ignition battery) --> Can I just buy from Aliexpress? Any specifics to look for?
    Programmer: ST Link V2 --> Still needed?
    -- Bluetooth module: HC06 --> Still needed?

    Maurice
  • @Maurice: Please see list of parts in the .ino -file.

    The RPM "probe" is just a wire (antenna) connected to a STM32 pin. It triggers the interrupt in the code even when the probe is at a distance away from the spark plug wire. It can even pick up close by engines (other than the intended one), so it might be wise to add some sort of filter or protection. I think you risk latch-up (or even frying) the STM32 if you wrap an un-filtered probe several times around the spark plug wire.

    Does anybody have a suggestion for filter/protection circuit?
  • @DrMotor Here is a circuit I use for RPM. This circuit requires to wrap a copper wire 9-10 times around the spark plug lead. It works very well.
    https://imgur.com/a/B8z2Sxx

    Or I saw that is possible to put a hall sensor near the magnets on the crankshaft that are used to produce a spark.
  • Thanks, I found the .ino file, with all the instructions. I will try to make a schematic later this week, and post it here.

    As I plan to use it on a motocross/enduro bike, I would like to add front and rear wheel RPM, to detect slip, comparing the front wheel speed with rear wheel speed and GPS speed. The front wheel does have a bicycle type speedo pickup magnet. To the rear I will probably add something similar.

    But first, I will have to order the parts and get the basic version ready.
  • Update: v0.7.5
    -- Added a connection sketch and removed the net-list. The sketch shows RPM-probe with capacitive coupling at both ends. Included also 220 Ohm pull-down resistor and pin protection via Schottky and LED. The RPM probe is less sensitive with this connection and the function is more stable.
    -- All unused GPIO are set to digital output LOW -- in order to reduce sensitivity to electric noise and avoid latch-up.
    -- Removed -1.0 from accel_z.
    -- Spell check and corrections to comments, added a recommendation: "Start with a simple system first, e.g. only Blue Pill + Bluetooth module + Temperature sensor, powered via USB from PC or a power bank".

    https://drive.google.com/open?id=1DdgsAEzTpjWBps2CjJOlqwJ4BzUtCaSr

  • Thanks for the sketch. Together with your notes in version .7 I was able to create a sketch myself. I added the Items I ordered from Aliexpress earlier this week.
    I drew the RPM sensor floating only on the spark plug wire side, maybe that's not enough...

    https://www.dropbox.com/s/hfnt6cl8mlb8kjd/RaceTemp0.75.pdf

    I also ordered a box to assemble the parts into, as the MX environment is harsher than karting.
  • Hi Maurice, thank you for the nice sketch! -- much straighter lines than mine :smile: Comments:
    -- I plug USB power into the USB slot at the other end of the Blue Pill.
    -- I use 2x capacitive coupling for the RPM. Mychron and Alfano laptimers also have capacitive coupling at both ends of ignition probe.
    -- Hall sensor for timing via magnet strips should be latching (not ratiometric) and have high sensitivity. I will try OH4913B (ordered from Aliexpress), guzu suggested SI7202-B-00-FV.
    -- Missing GND for the coolant temp NTC. My Volvo sensors have chassis M10x1 = GND http://www.aliexpress.com/item/Brand-New-Coolant-Temperature-Sensor-Sender-For-VOLVO-240-740-760-940-2-4-TD-Turbo/32670042910.html, however other NTC sensors also work well e.g. those 100kOhm ones used for 3d-priters cost only a few cents.
    -- Ferrite beads are missing.
  • @mmrizio: two more things about the sketch:
    -- I never connected the RST pin on the StLink. It works OK without, but probably does not hurt to connect it.
    -- I use 3.3 V power input (not 5 V). Advantage of 5 V: lower noise -- the Blue Pill has a linear regulator providing 3.3 V for SMT32 and sensors. The linear regulator reduces noise. Advantage of 3.3 V: the linear regulator is tiny and can over-heat and burn out, it makes much less heat (and still shaves off some of the noise) when given 3.3 V input.
    -- I use a Bluetooth module without carrier board like shown in picture below, and it needs 3.3 V (should not be connected to 5 V). Bluetooth modules with carrier boards normally also work OK when connected to 3.3 V -- even if the print says 3.6--6 V. image.
  • Observation: RaceTemp v0.7.5 can send $RC3 messages at >120 Hz (and at the same time $GNRMC and $GPGGA at 10 Hz) when using HC06 Bluetooth module, but only 20 or 40 Hz when using the JDY-30.
  • I tested the speed again and found: $RC3 rate of 333 Hz works OK when using HC06 Bluetooth module at baud rate 921600, but RaceChrono on my phone is not able to process and display at so high rate
  • edited August 2018
    RaceChrono tries to "even out" the timestamps that it figures out by looking at "counter" field of $RC2/$RC3 sentences, and the current code has maximum of 10 ms intervals, therefore 100 Hz is maximum. If you use timestamp field, then you're not limited to this. But the UI gets really slow with > 20 Hz anyways. I will improve the UI over next autumn/winter and it should then handle 100 Hz just as well.
  • Hi DrMotor, I updated the sketch --> https://www.dropbox.com/s/8leguhzyx7pivhb/RaceTemp0.75b.pdf?dl=0

    Regarding the coolant temp sensor: Do you mean: GND is supplied via a generic connection from battery (-) to vehicle ground? Or do you suggest adding a separate ground line?
    Regarding 3.3V: I like your idea of feeding everything with 3.3V, also because the DC converter has more capacity. But are you sure it is not a factor in the JDY-30 performing less?
    Regarding frequencies: The higher, the better.... but: I don't think I have any requirements at the moment for faster intervals than 10Hz, other than high accuracy for lap times.
  • Hi mmrizio, the sketch looks even better now, but the diodes and pull-up resistor must be on the green line -- on other side of capacitive coupling.

    One might for example want accelerometers to report at a rate higher than 10 Hz in order to reveal shaking and bouncing of wheels and chassis (but 333 Hz was just for testing the limits).

    There is something wrong with all of my JDY-30s (and it is not caused by the voltage -- the datasheet says 2.2 to 4.2 V, so 3.3 V should be fine). The firmware has bugs:
    When I write "AT+BAUD9" to the JDY-30, then it correctly answers "+BAUD=9", "OK", and correctly sets baud rate to 230400, but when I write "AT+BAUDA" (to set baud rate 460800), then the it incorrectly answers "+BAUD=11","OK" (correct answer should be "+BAUD=10", "OK"), and it then resets baud rate to only 9600. Also AT+BAUDB and AT+BAUDC leads to 9600.
  • My Rotax senior kart rpm。Can you share your usage videos?
  • @DrMotor
    Has your device been tested on the track? Can rpm be displayed accurately? My rpm sensor is the same as yours. The karting was tested on the shelf, the rpm was basically accurate, and the errors were few. When I ran on the track, the rpm was wrong.
  • @lzzl551 Water temp, GPS, accelerometer and pedal sensor were used at track. rpm was only tested at stand and magnet strip pickup only at low speed. I cannot drive the gokart since several weeks because of my ribs.
  • @lzzl551 video for you

    The RPM probe is still too sensitive (even with capacitive coupling at both ends). It works best when 50 mm or so away from the spark plug cable. If wrapped around the spark plug cable, then it will pick up additional pulses and give wrong RPM.

    Next: I will add a ceramic capacitor in parallel with the diodes in order to reduce sensitivity.
  • ha ha -- it works! :smile:
  • @Issl551: rpm, gps, video, and audio all out of sync, or is it only the rpm ?
    I think we need to write timestamps in the $RC3 messages (in stead of the message counter currently used).
  • @DrMotor
    only rpm.I use count,I will try timetrap this week
  • Hi, I have been using Racechrono for a number of years and I am trying to build a Arduino Uno data device for measuring RPM and pedal position.
    I have tried a couple of the sketches that I have found on this site but I am not getting any data at the phone. The phone sees the HT-05 module in Racechrono. The sketches I have tried were written by Guzu and DrMotor. I have tried the sketches as they are written and in modified form with the additional features such as temperature etc turned off. Even when they verify and compile ok it does not work.
    I have tested the Arduino with a basic sketch and the mobile picks up the BT signal using an app called Ardu Tooth so I have the BT set to act as a slave. I have set the Tx/Rx pins to pins 2 and 3 using SoftSerial. The BT board is a Freetronics Shield with jumpers to select the Tx/Rx pins. The baud rate is set at 9600.
    I can see the pedal position move on the Serial Monitor as I turn the 5k pot.
    Any ideas as what to try next would be appreciated. I had a telco background but I am new to coding and the only past experience was with Basic some forty plus years ago.
    Thanks in advance
  • It has been quiet from my side for a while. I had issues getting the right parts in, and then installing the bootloader using the STLink. I finally managed, using the STM32 Flash loader demonstrator tool and a USB to serial adapter.
    After some fiddling I got the application running on a testbed last night.
    I also have issues connecting to the MPU. When I activate it, the application does not pass the MPU Setup stage. Same behavior on both units I have... absolutely no life in them (yet).

    I have soldered a small board for distributing power and mounting the diods, but no opportunity to try the RPM and "analog channels" yet. And I would really like to also get the gyro and the g-sensor from the MPU-9250 to work.
  • @aol
    My DIY device is connected to racechrono, which includes GPS, RPM sensor and water temperature sensor. GPS uses ublox M8030 chip to support GLONASS and GPS. It seems that racechrono can't receive GLONASS data, and can only lock up to 13 satellite data. In the same situation, xgps160 can lock more than 20 satellites. I want to know if racechrono supports DIY devices to receive GLONASS data。
  • My DIY device receives the same number of satellites (16) as my regular data logging phone with GPS and Glonass. I also see no reason why RaceChrono would not accept Glonass, as the decoding is done in the GPS receiver and sent to RaceChrono as NMEA sentences. Could you check the config of your GPS receiver in U-Center, and the number of satellites it receives without RaceChrono connected? You may need to un-filter some sentences, or hook up your GPS receiver through a USB to UART connector to get full U-Center functionality.

    I am in a similar process, wanting to also receive Galileo satellites. These apparently are more precise. And because I am European :-).
    Soon we will also be able to use cm-accurate reception, using an additional base station, when RTK becomes more mainstream.
  • edited September 2018
    For RaceChrono it's unnecessary to send both GN* and GP* sentences. You can filter out either ones to limit bandwidth. The satellite count is just a number that is extracted from the sentences. It is just what your GPS reports.
Sign In or Register to comment.