Author Topic: Arduino fun..  (Read 4448 times)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #50 on: February 08, 2012, 09:11:25 pm »
Interesting ideas.. I was thinking about optical sensors but figured that at a roller racing event it has to be lots of camera flashes proof, and I couldn't guarantee that with an optical setup.

I'll look into hall effect sensors. At present I have the magnet cable tied into the non-rubber band groove of a standard set of tacx 4" rollers, with the reed switch sticky taped on the inside of the frame. I don't plan to physically alter the rollers and reckon that a cable tie on a rubber pad (to minimise movement by providing a high friction interface between magnet mount and rollers) will be sufficient. Being able to also use a wheel magnet would be a bonus - then needs a software config to get the right speed.

The idea is to have this in a static situation, not as a mobile bike computer.
At present the reed switch appears to work so I am happy thus far, and will now start to clean the verdigris off my Java coding skills and get some sort of app up and rolling to deal with the data.
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #51 on: February 08, 2012, 10:24:48 pm »
Optical sensors work really well - stick a bit of retro-reflective (AKA scotchbrite) tape on the tyre/flywheel, shine a modulated IR source at it with a coaxially-mounted receiver and you should find it works over 5m or so (not really an outdoor solution, as per above due to dirt issues). Not too sure arout AVR chips, but PIC chips (dsPIC30/33) have a MAC instruction that really helps for this sort of approach (and for bonus points, lets you pick up Polar HRM signals with a couple of extra components).

Easy to prototype with the kind of spoke-mounted reflectors that come with new bikes - we hacked up a sensor using a stock cateye  AU100 rear light, using the outer LEDs at the light source and the big central LED as the receiver. Surprisingly, at a few inches range it worked so well it wasn't even necessary to modulate the light source (though where there are camera flashes or other interference, a modulated light source is going to work much, much better).



Feanor

  • It's mostly downhill from here.
Re: Arduino fun..
« Reply #52 on: February 08, 2012, 10:40:10 pm »
Now then, Dr. M.
We're expecting you to impliment an IPv6 stack on this by the weekend.

The RevK would.


Kim

  • Timelord
Re: Arduino fun..
« Reply #53 on: February 08, 2012, 10:44:47 pm »
Ah, now you're talking.  Just read off the IPv6 address of the closest spoke, and track the wheel rotation that way...   ;D
Careful, Kim. Your sarcasm's showing...

Re: Arduino fun..
« Reply #54 on: February 08, 2012, 11:08:30 pm »
Having a brief look around, some people have been accessing Arduino's using IPv6, so with those it looks to be perfectly possible (I'm not sure of the exact status of the libraries, but there's certainly some useful information out there).

Time to connect my toaster to the Internet. ;D
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #55 on: February 08, 2012, 11:44:01 pm »
IP stack is definitely thought about though I might do that the easy way and just wait for a Raspberry Pi.. It should (as long as I can sort out the voltage difference between Pi and TTL (3.3 vs 5v) be able to talk to it quite happily.

..d
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #56 on: February 09, 2012, 09:22:27 am »
... or don't use TTL.  Most CMOS will happily operate at 3.3V. For example, the 7414s you mentioned earlier (probably actually something like SN7414N) could be replaced by a 74HC14 (not 74HCT14 which is a TTL compatible variant, and probably isn't designed to operate at 3.3V).
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #57 on: February 09, 2012, 09:29:19 am »
I was using 7414 as a generic.. the ones I actually used were DM7414N which are min 4.5V. I'll look at the 74HC14 (didn't realise there were so many different flavours of essentially the same thing - why should I not be surprised?)

5V however matches nicely with the voltage from USB.

Edit: Looking at the datasheet, it appears that the 'high' output voltage is 3.4 anyway, and as Vcc doesn't need to be connected (if it does then I can't get it to work so empirical approaches take the win) it seems to be fine. The hysterisis thresholds will work fine with 3.3V logic.

"By creating we think. By living we learn" - Patrick Geddes

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #58 on: February 09, 2012, 09:33:50 am »
Anyway, I've found some unipolar non-latching hall effect ICs and will give them a go when they arrive. They are cheaper than reed switches and are rated to 20kHz which should be amply fast enough, even for my legs :)
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #59 on: February 09, 2012, 09:43:28 am »
You've got to be careful with valid logic levels at the input and output of devices.  The valid output levels are normally more narrow than the valid input levels (to guarantee that they'll work).

As a rule of thumb, for most CMOS devices the valid voltage range threshold points for logic are 33% and 66% of VCC.  TTL is quite a bit different (and not as symmetrical), so strictly speaking you shouldn't just connect TTL and CMOS simply together, because what's a legal output level for one of them isn't necessarily a valid input level for the other!  The 74HCT family is slightly unusual in that it largely has the characteristics of CMOS (it's a CMOS device), but the logic levels are adjusted to work with TTL.  It does tend to have a much more restrictive set of operational voltages (ie VCC is probably limited to something like 4.5 to 5.5V vi 3V to 18V for typical CMOS).

It's not helped by there be many different versions of these sort of devices from manufacturers, all with slightly different characteristics!  Check the data sheets carefully.

Having said all that, often it will probably work, but not necessarily reliably, and if you changed a component, it's slight variation within the allowed spec, might mean that it stopped working.  I've seen some truly bloody awful cases were people have constructed circuitry that does work, but only because they've been lucky, and with another set of components that may not be the case.  For home hacking it's probably OK, but you wouldn't want that with a commercial product.

The Teensy's I've been using normally operate from the 5V provided to them off of the USB interface.  If you want to hang 3.3V devices off of it (which I did), you can add a small 3.3V regulator onto the board (it's designed to accommodate this), and the CPU has separate VCC lines for the USB interface (which has to work at 5V) and the remainder of the IO, which can operate at 3.3V or 5V depending on what you provide.
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #60 on: February 09, 2012, 11:16:05 am »
Thanks for the explaination. I'll swap the 7414s for 74HC14s and see how robust that is. it will be fun to put the reed switch and hall effect sensor on the same roller and see if there is any difference in output.
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #61 on: February 11, 2012, 08:31:16 am »
The 74HCT family is slightly unusual in that it largely has the characteristics of CMOS (it's a CMOS device), but the logic levels are adjusted to work with TTL.  It does tend to have a much more restrictive set of operational voltages (ie VCC is probably limited to something like 4.5 to 5.5V vi 3V to 18V for typical CMOS).

The 74HC series has a supply voltage range of 2 - 6 V
The 74HCT series has a supply voltage range of 4.5 - 5.5 V if you want the inputs and outputs to be compatible with TTL
The 4000 series has a supply voltage range of 3 - 15 V

(just so that you don't go running your 74HC14 ICs from 12 v)
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Arduino fun..
« Reply #62 on: February 11, 2012, 09:00:06 am »
Oops, yes. Good point.

The 3-18V VCC range is only really generally valid for "traditional" CD4000B CMOS.  Even the slightly older unbuffered 4000A series doesn't generally have quite that range, I think they generally top out at 15V.

Even for the 74HCT equivalent families istr that I've come across some which work outside the more general 2-6V range, although I can't lay my hands on a data sheet after a quick Google.

The NXP version has an absolute maximum range of VCC of -0.5 to 7V, but that's probably not operational (just tolerable), and also claims that inputs can exceed VCC by up to 0.5V, which sort of implies that you can put 7.5V on an input (but I'm not certain of that, given that they are absolute maximum values).

The 74HC4000 series tends to inherit the DC and AC characteristics of 74HC and only the functionality and pinout of 4000 series.
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #63 on: February 11, 2012, 08:48:42 pm »
Maybe I'm doing this wrong but I found that if I connect the VDD pinon the 7414 then I don't get anything sensible out. If I leave it disconnected then I get the switching state I expect. (VSS is connected). So on the basis of 'it works' I have gone with the latter.

Waiting on Hall effect sensors and then I can try both a reed switch and a hall effect sensor on the same roller at the same time and see 1) whether there is any difference and 2) which way the difference goes.
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #64 on: February 11, 2012, 10:17:49 pm »
Erm, that doesn't really make any sense.  If VDD isn't connected, but VSS is (presumably to GND) then, assuming that you're only using a single one of the devices, and they're inverters, if you've got a low input to the device, there's nowhere for the high output voltage to come from.

If you have got multiple inputs connected, then you're powering the circuit from the other pins (those which are high) which is highly unpredictable.

A thought does occur, have you got the input biased when it's not connected?  If my memory serves me correctly, TTL is generally pulled high by internal resistors, so you either need to use the reed to pull the input low, or you need something to bias the input to provide adequate current to pull it low if the reed is connected between VDD and the input.

If the reed is just connected between VDD and the input (with nothing else), then yes, you will probably see no effect when it closes, because the input will always be held high.
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #65 on: February 11, 2012, 10:33:14 pm »
Input is held high with a pull-up resistor and closing the reed drops it to VSS. Connecting VCC to the correct pin gives an in between value of about 2.4V. It strangely appears to work but I'm not sure why.

"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #66 on: February 11, 2012, 10:40:13 pm »
... but if you've got the input held low, and VDD isn't connected, how can you get a high output from the device?  It's got no power source to provide that input.

Either you've got something else wired into it, or you've perfected getting power from nothing!

(There's no point using a pull up resistor on a TTL input, it does that internally, all you're doing is increasing the circuits power usage).
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #67 on: February 11, 2012, 10:59:07 pm »
I'll have to go back and double check what is going on. It is quite possible a wire is misplaced.

So I should be able to ditch the external pull up, and in the absence of a connection to ground, should get a 0V output? Connect input to ground and it should give a 5V output. That should be easy to test.

.d
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #68 on: February 11, 2012, 11:33:00 pm »
That's how it should work.  The Schmitt trigger input shouldn't make any significant difference to the basic functionality of an inverter.  If it's simply grounded or pulled high, then the output should just be the opposite (and it's not an open-collector device, where the output would behave somewhat differently).

The same isn't necessarily true of logic families which aren't just bog standard TTL.  74HCT looks to behave differently.  CMOS generally doesn't pull inputs up or down, and you run the risk of inputs oscillating, and increasing the devices power consumption.  You do need pull up or down resistors, but as I recall, they can be quite big values, because the current needed is a lot less.  A quick Google suggests that the low input current on TTL is 1mA but the high input current is only 40µA!  For 74HC (and 74HCT) the input current for a low or high state looks to be around 1µA (ie around 5MΩ resistors, so possible use 1MΩ to guarantee it works solidly).
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #69 on: February 12, 2012, 09:48:20 am »
I've been, in the tradition of 'whatever is at hand' been using 10K as pull-up resistors. Maybe I should up that a bit. Back to the test bench (the dining room table) this evening then to see what can be done.
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #70 on: February 12, 2012, 05:36:13 pm »
Doing a quick Ohms law calculation, naively to get 1mA from 5V would require a 5KΩ resistor, but of course it's not as simple as that, since you need to take into account the impedance of the input itself.

I would have guessed something like 10KΩ, but don't recall it as ever really being a problem.  Generally with TTL, you tend to arrange things so that the input's natural internal pull-up does the work, and connect switches etc to ground.
Actually, it is rocket science.
 

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Arduino fun..
« Reply #71 on: February 13, 2012, 10:33:30 pm »
I've had a chance to play. The 7414 seem to give peculiar results. They seem to be limited to an output of about 3.6V and don't behave quite as expected.

The 74hc14 however do exactly what I expect. I do need a pull up resistor to tie the input high but it can be big - a 1M resistor works fine as does 10K. So rather than mess with the 7414s I'll switch to the 74hc14.

Mnay thanks for the heads up. I've wired up a prototype board that should read two 8 bit counters into a 2 byte serial register, yet to try it in action. I'm waiting for the Hall Effect sensors to arrive so I can see how they work.
"By creating we think. By living we learn" - Patrick Geddes

Re: Arduino fun..
« Reply #72 on: February 13, 2012, 11:40:59 pm »
That's kind of odd, I used TTL a lot in my youth, and it's generally pretty hard to break it, but that sounds a little weird.  Ah well, I guess it's possible the device was dead from delivery.  Still if the 74HC14s are working, I guess that's good enough.
Actually, it is rocket science.
 

Re: Arduino fun..
« Reply #73 on: February 14, 2012, 08:02:45 am »
74HC circuits will often work fine with no Vdd connection.

What is happening is that the power rail on the IC is being held up by the input clamping diodes that don't let any input go more than 0.7 V above the supply.

What that will have done is that it will reduce the Vdd which will cause the input threshold voltages to fall, which could make it more reliable when one of the inputs is connected to a TTL signal or a lower voltage CMOS signal.

It is not a good idea to run ICs like that. It is very easy to exceed the allowable input current. The supply voltage and therefore the IC behaviour is unpredictable, and you may be overloading whatever output is feeding it. You can also get undesirable logic effects, because when all the inputs to the IC go low, then the supply voltage falls to nothing and all the outputs go low.

If you want lower threshold voltages, you should either reduce the supply voltage and make sure that it is controlled, or use 74HCT gates.

A lot of the more modern logic ICs have different input clamping arrangements.  Many now have zener diode clamping, that has no connection to the +ve supply. With that arrangement, the input voltage will not leak through to the supply, so if the supply is unconnected, but the inputs are high, the supply drops to zero, and so do all the outputs.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Arduino fun..
« Reply #74 on: February 14, 2012, 08:17:13 am »
Ah, it hadn't occurred to me that the 3.6V might be from the previous scenario of not having VDD connected, but yes, you wouldn't expect the output to be as high at should be in that case.

I remember getting some truly bizarre behaviour out of counters that were being powered like this. They would do things like consistently count, but not in the correct order!
Actually, it is rocket science.