Categories
Uri_ba's pit

[Tech-Post] Encoders – re-discovering the obvious

I didn’t write any proper “tech post” in  a while. However while working on the ICP I’ve had to re-learn (like everytime) the basics.

This time it’s encoders that got my attention.
The Web is filled with howtos and tutorials about encoders, pages upon pages upon videos. all demonstrating and explaining how everything works.

in a sentence or two (or more), Rotary encoders have two output pins, connected to a common pin. When the encoder is in a detent (or stop), both pins are the same state, which is OPEN. when rotated, the pins pulse on and off between the stops, they do it in a staggered way. allowing us to determine rotation direction (and speed) of the rotation. I’ve yet to learn the speed bit, so let’s concentrate about direction. the pulses look something like this:

Rotary Encoder pulses (from the Arduino website)
Rotary Encoder pulses (from the Arduino website)

In this diagram the outputs are pulled down, and the common is connected to 5V. it can of course be the other way around.

to get the state we can use poll, an interrupt pin attached to one of the outputs, or two interup pins. attached to both outputs. the more interrupts you use, the less chance you will miss a pulse causing a step to be missed).

Regardless of the option you choose to use, all the articles have  an elaborated list of if statements, designed to figure out which thing goes where.. something in the spirit of:

if (pinA == HIGH) {
  if (pinB == LOW) {
    // it turned CW
  } else {
    //it turned CCW
  }
} else {
  if (pinB == HIGH) {
    // it turned CW
  } else {
    //it turned CCW
  }
}

Anyway, this is long, complex and pretty hard to understand.
But if we create a truth table based on the diagram above it reveals a little loophole.

 what triggered/pin status  A1B1 A0B0 A1B0 A0B1
ΔA  CW  CW  CCW  CCW
ΔB  CCW  CCW  CCW  CW

as you can see, the pin that changed, determins the rotation. if we use interrupt on pin A then:

if (pinA == pinB) {
    //it turned CCW
} else {
    // this is CW
}

Interrupt on the B pin will be the other way around.

And if you are triggering on both it’s also quite easy. you just need to use the correct if statement everytime.

That’s pretty much it 🙂

Categories
Uri_ba's pit

DEDuino – V.1.2.0

DEDuino version 1.2.0 is finally here.
The main change is the switch to i2c protocol to drive the lights. However several other change has also has been implemented.
To support the new features, a new software version has been released. please note that this version is not backwards compatible with the old code. and vice versa, DEDuino 1.2.0 can only work with app version 0.0.1.0 and up. please note that DEDuino software will not automaticly update major version – so current devices should not be effected.
Categories
Uri_ba's pit Weekly Updates

Weekly update – 2015/08/16

This week’s topics:

  • ICP still stuck in customs  😐
  • Still working on the eyebrow lights – hope to get it done sometime soon 😉
  • DEDuino code and app are going through some major changes and evolved quite nicely over the last few weeks
  • Caution Panel – I’ve ordered a caution panel from Jshep, in stead of building one from scratch.
  • DEDuino “User guide”.
Categories
Uri_ba's pit Weekly Updates

Weekly Update – 2015/08/09

This week’s topics:

  • Cougar TQS update
  • Glareshield lights support for DEDuino
  • and my ICP still stuck in customs
Categories
Uri_ba's pit

Quick tip – Binary to HEX and DEC conversion

I’ve been doing some work on the code, mostly involving i2c commands and addresses. Those are usually given in Hex in the datasheet, sometimes with binary reference, but you might find yourself needing to convert between the two and sometimes to Decimal.

There is a quick way to convert back and forth between all of them by hand with nothing but a piece of paper (you can do it in your head if you are good with numbers – I’m very bad at it :))

Anyway it’s a good old trick but it works.

Categories
Uri_ba's pit

Baby steps for the future – Hello world

As I’ve might have mentioned in the past.  Arduino was not intended to be “my holy grail” it was a fast implementation (should have been fast at least :)) towards a “better tomorrow”.

Today I’ve made my first baby step towards that future.

Categories
Uri_ba's pit Weekly Updates

Weekly Update – 2015/08/02

Time for our brief quick weekly update.

This week’s topics:

  • DEDuino 1.2.0 is nearing
  • Redneck’s ICP is stuck in customs
Categories
Uri_ba's pit Weekly Updates

Bug in the 0.0.0.6 app

In the latest App version (0.0.0.6) there is a bug that prevents the normal standby text to appear. On some cases, garbage my be written on the on the displays. Once falcon is launched and in flight, it should work correctly.

I hope to release a fixed version later this weekend.

Sorry about that,
uri

Categories
Uri_ba's pit Weekly Updates

Weekly Update – 2015/07/16

After a long long time, I figured it’s as good as any time to say a little on where I’m going in the near future.

  1. I need a new caution panel to work with I2C, I’m also switching from “source” to “Sink” si I’ll need to rewire the entire caution panel. so i’m in the process of figure out how is the best way to do it (and make it better) – either way, it’s about 8 hours of hand wiring I’m not looking forward for.

  2. once I get the CP done, I’ll need to adjust my DEDuino code, and I’ll be releasing it. the i2c code is already available in the git (1.2.0 – alpha 2). I’m looking forward for 1.2.0

  3. ICP – it’s really, really overdue. it seems that 90% of the time my hand touches the mouse it’s for the ICP.  I have a unique opportunity with the ICP, I’ll update on that when I can.  but it will be another project starring the Arduino Pro-micro and the LUFA library 🙂

Categories
Uri_ba's pit

Modding the TM Warthog with Ribbs Cougar tailpiece adapter

It has been a very long time since the last post. I had too many real world issues that I’ve barely touched the pit. however, sometime in late May I’ve got the Ribbs Cougar tail adapter for my WH stick.

it’s just the standard adapter – that fits both sticks (WH and cougar) and places the SSC in it’s correct forward 13 degrees forward position. naturally it is ment for Force modded sticks (FCC/FSSB) but it also improved the holding angle for the moving stick.

I know this is not perfect – but you can clearly see the angle change on the stick.

WH stick before and after the mod
WH stick before and after the mod

the swap is fairly easy.