Code Monkey home page Code Monkey logo

Comments (4)

tttapa avatar tttapa commented on June 7, 2024

Because of the asymmetry of this driver (see the H-SW Control Function table on page 4 of the datasheet, HHHH→LL and LLHH→Off), you should use the modifications explained in #18 (comment)

Using those changes, then connect the driver as follows.

Arduino pin Driver pin
2 (PD2) AIN1
3 (PD3/OC2B) PWMA
4 (PD4) AIN2
5V (Vcc) STBY

To wire the motor and the power supply, see the Typical Application Diagram on page 7 of the datasheet.

If you want to use more than one fader, you'll need to change the code for the other motors as well.

from control-surface-motor-fader.

Ilosariph avatar Ilosariph commented on June 7, 2024

Thanks for that quick answer. The code change seems simple enough and makes sense (though I don't understand most of the code, I understand what you are changing). I'll try it tomorrow and let you know the results of my attempt.

from control-surface-motor-fader.

Ilosariph avatar Ilosariph commented on June 7, 2024

So I've tried it (with the test reference), but it's not working. I have a theory:
I am using an Arduino Mega rev3. The pinout of it shows the PD2 as D19, the OC2B (which is the important part about this connection if I understood your comment on the other issue correctly) is D9 and PD4 is the RX LED, which makes it inaccessible for me.
I did try it with AIN1 to D19, PWMA to D9 and AIN2 to D3 (for a lack of better option). I tried using D2, D3 and D4 as well.
Reading the fader position with the print_controller_signals flag works as expected. Driving the motor and touch detection work with a simple Arduino script, so the fader or driver aren't broken and the power supply should be sufficient.
Is there an easy way to make this work with the Arduino mega or should I just buy a nano?

Hardware:
The fader is the 5K version of the one you used.
The connections on the diagram are made with the letters / numbers from it's datasheet.
Fader_Connections_Improved_Steckplatine

from control-surface-motor-fader.

tttapa avatar tttapa commented on June 7, 2024

It should be possible to make it work on the ATmega2560, but you'll have to change the pins used.

Specifically:

  • pick a different port for the touch pins (e.g. PA instead of PB)
  • pick different motor AIN1/2 pins
  • change the overrun indicator pin from PB5 to PB7

In the code, change the following lines:

// Bit masks of the touch pins (must be on port B):
static constexpr uint8_t touch_masks[] = {1 << PB0, 1 << PB1, 1 << PB2,
1 << PB4};

cbi(PORTB, 5); // Clear overrun indicator

if (Config::enable_overrun_indicator) sbi(DDRB, 5); // Pin 13 output

PORTB &= ~gpio_mask; // low
DDRB |= gpio_mask; // output mode

if (counter == 0) {
DDRB &= ~gpio_mask; // input mode, start charging
} else if (counter == touch_sense_thres) {
uint8_t touched_bits = PINB;
DDRB |= gpio_mask; // output mode, start discharging

sbi(DDRD, 2);
sbi(DDRD, 3);

(Or your modified version)

from control-surface-motor-fader.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.