Wet / Magnetic Compass With hardware Calibration

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Post Reply
Message
Author
bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Wet / Magnetic Compass With hardware Calibration

#1 Post by bmooneyhan »

Hi all,

Has anyone used this hardware instrument? If so, some questions:

1. Is there no option to select VID66-06 type stepper from the GUI? If so I sure don't see it.
2. When using a pin with a sensor to calibrate to a known position, is that pin expecting to toggle to ground when the sensor is tripped? just like a pushbutton would?
3. Does anyone have example code of doing this?

Thanks in advance.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Wet / Magnetic Compass With hardware Calibration

#2 Post by Keith Baxter »

bmooneyhan wrote: Fri Mar 31, 2023 7:09 pm Hi all,

Has anyone used this hardware instrument? If so, some questions:

1. Is there no option to select VID66-06 type stepper from the GUI? If so I sure don't see it.
2. When using a pin with a sensor to calibrate to a known position, is that pin expecting to toggle to ground when the sensor is tripped? just like a pushbutton would?
3. Does anyone have example code of doing this?

Thanks in advance.
Hi,

You found this not? :D
ice_screenshot_20230331-220910.png
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Re: Wet / Magnetic Compass With hardware Calibration

#3 Post by bmooneyhan »

Hi KB,

Yes I have installed and have the compass turning, trying figure out the calibration.

Thanks.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Wet / Magnetic Compass With hardware Calibration

#4 Post by SimPassion »

bmooneyhan wrote: Fri Mar 31, 2023 8:13 pm Hi KB,

Yes I have installed and have the compass turning, trying figure out the calibration.

Thanks.
image.png
image.png

Handled natively in AM :
https://siminnovations.com/wiki/index.p ... d#VID66-06

Code: Select all

Example

-- Initiate stepper motor with:
-- 2048 steps
-- 10 rpm speed
id = hw_stepper_motor_add("My stepper motor", "VID66-06", 2048, 10)

-- Set position
hw_stepper_motor_position(id, 0.5)
https://siminnovations.com/wiki/index.p ... _calibrate

Code: Select all

-- We have a sensor halfway of our stepper motor
-- When this input is high, the stepper motor will be set to virual position 0.5
hw_input_add("ARDUINO_NANO_A_D6", function(state)
  if state then
    hw_stepper_motor_calibrate(id, 0.5)
  end
end)

bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Re: Wet / Magnetic Compass With hardware Calibration

#5 Post by bmooneyhan »

So I see your screenshot of the GUI, and then I see the code that is in the hardware. Is this to illustrate that the GUI configuration elements work together with the line configured as "VID66" in the hardware code? Currently I have my stepper coded in the hardware, pin bindings and all, with nothing configured in GUI.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Wet / Magnetic Compass With hardware Calibration

#6 Post by SimPassion »

bmooneyhan wrote: Sat Apr 01, 2023 5:56 pm So I see your screenshot of the GUI, and then I see the code that is in the hardware. Is this to illustrate that the GUI configuration elements work together with the line configured as "VID66" in the hardware code? Currently I have my stepper coded in the hardware, pin bindings and all, with nothing configured in GUI.
Hey, if one were applying the sample found on the wiki on our own, we were already seeing this is done only with binding ourselves manually
Just screenshot and scripts are totally de-correlated, the screenshot is showing what we see with an available hardware instrument from the Online Store, nothing to do with the VID66-06 itself

Just did at the moment for you ...

image.png

bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Re: Wet / Magnetic Compass With hardware Calibration

#7 Post by bmooneyhan »

Thanks very much! I will get this working!

bmooneyhan
Posts: 32
Joined: Tue Jan 08, 2019 8:28 pm

Re: Wet / Magnetic Compass With hardware Calibration

#8 Post by bmooneyhan »

Good morning all,

I always try and circle back to let those who helped out know, I got this compass working. I had mistake in my code (stepper ID) and now it's good. It tracks the in-game wet compass and auto-calibrates using an optical sensor. I'm using the x27 168 stepper motor with the A4988 stepper driver. My binding for the stepper controller pins and the calibration pin is done in the code, not in the GUI. There may be a little fine-tuning left to do, and I haven't tried micro-stepping yet to see if it's much smoother.

As always, thank you everyone for your support. The Wiki and support forums are my favorite AM features.

Buddy

Post Reply