IEEERobotics / bot

Robot code for 2014.
BSD 2-Clause "Simplified" License
17 stars 10 forks source link

Fully functional IR arrays #63

Closed dfarrell07 closed 10 years ago

dfarrell07 commented 10 years ago

This is a meta-issue used to track our progress towards the Base Functionally milestone. @R00ney is in the process of installing the new IR array hardware. As described in #52, I'm working on refactoring the IR code to work with this hardware. Once those two steps are done, we'll need to do some calibration and testing.

dfarrell07 commented 10 years ago

@R00ney, @napratin and I worked on this for a solid 5.5 hours tonight. We hacked through a ton of problems, but made awesome progress. Frankly, I'm a bit too tired to try to explain everything at the moment. Maybe @R00ney or @napratin can hop on tomorrow and give a more detailed update.

R00ney commented 10 years ago

Ok, one longish explanation coming up.

After @napratin actually read the documentation for the Pololu "Digital" IR arrays and I called myself seven kinds of stupid, we've decided that 1) Pololu has bastardy marketers for calling this product "Digital", and 2) it would require too much low-level control and/or extra circuitry to handle the precise timing requirements of these IR Arrays for them to work in our system. Thus, we will abandon the "Digital" IR array product for now.

We had success with the I2C ADCs. We were able to get two ADCs fully communicating with the BBB, and have demonstrated that they can read the analog voltages coming from the 16-1b analog mux. We've also demonstrated that it will be simple to add two more, for a total of 4 I2C ads.

Things to do:

If anyone wants to take a stab at building the two more boards, I should be available by email and hangout to explain the circuit. Start by looking at the Pololu Analog IR Array datasheet, the Analog Mux datasheet, and the ADC datasheet.

http://www.pololu.com/product/960/

http://www.ti.com/lit/ds/symlink/cd4067b.pdf

http://www.ti.com/lit/ds/symlink/adc081c021.pdf

napratin commented 10 years ago

@R00ney and I made some progress on the analog arrays today. The select lines coming out of the bone weren't properly mapped to the ADC, resulting in data that was interleaved in weird ways. Besides this, there also seem to be loose connections/shorts across select lines and/or IR sensor input lines resulting in a single IR unit value appearing in more than one position.

Exhaustive enumeration using one of the arrays (previously 'back', currently 'right') resulted in this mapping from sensor position to data position (e.g. sensor units at positions 3 and 7 both showed up in data positions 0 and 2): ir-array_remapping-02

After reversing the select lines and making appropriate code changes (ead60921ff1c1845a82de4b227a499fa1496115c), including swapping the higher and lower halves of each 16-unit array output, I was able to get correct ordering but semi-consistent performance (ghost or duplicate values and some intermittent failure). But the 'front' sensor turned out to be in better shape. Here's a dump of the front sensor values printed as I moved it across a piece of black tape (on white desktop):

225 184 17  13  13  13  13  14  13  13  13  12  13  14  12  14
225 185 17  13  13  12  12  14  13  12  13  12  13  14  13  14
225 185 17  13  13  12  12  14  13  13  13  12  13  14  12  14
225 184 17  13  12  13  12  14  13  13  13  12  13  14  13  14
224 185 17  12  13  13  12  14  13  13  13  13  13  14  13  14
225 184 17  12  13  13  12  14  13  13  13  13  13  14  13  14
225 184 18  13  13  13  12  14  13  13  13  13  13  14  13  14
225 186 19  13  13  13  12  14  13  13  13  13  13  14  13  14
229 198 65  13  13  13  13  14  13  13  13  13  13  14  13  15
200 212 181 21  13  13  13  14  13  13  13  13  13  14  13  15
125 197 202 125 13  14  13  14  13  13  13  13  13  14  13  15
23  94  199 187 16  16  13  14  13  13  13  13  13  14  13  15
16  16  177 201 30  32  13  14  13  13  13  13  13  14  13  15
16  13  92  200 120 123 13  14  13  13  13  13  13  14  13  15
15  13  15  169 185 187 15  14  13  13  13  13  13  14  13  15
15  12  13  16  197 195 128 15  13  13  13  13  13  14  12  15
15  12  12  13  100 95  201 123 14  13  13  13  13  14  13  15
15  12  12  13  15  15  192 205 79  13  13  13  13  14  13  15
15  12  12  12  13  13  94  211 183 17  13  13  13  13  13  15
15  12  12  12  13  13  17  201 201 88  14  13  13  14  13  15
15  13  12  12  13  13  15  181 200 142 15  13  13  14  12  15
15  12  12  12  13  13  13  152 203 175 18  13  13  13  13  15
15  12  12  12  13  13  13  38  178 199 136 14  13  14  13  14
15  12  12  12  13  13  13  15  85  197 191 18  13  14  13  14
15  12  12  13  13  13  13  14  14  132 208 162 16  14  13  14
15  12  12  12  13  13  12  14  13  13  86  199 192 51  13  14
15  12  12  12  13  13  12  14  13  13  15  157 204 160 14  15
15  12  12  12  13  13  13  14  13  13  14  37  198 201 58  15
15  13  12  12  13  13  12  14  13  13  13  14  164 209 160 20
15  12  12  13  13  13  12  14  13  13  13  13  18  199 213 187
15  12  12  13  13  13  12  14  13  13  13  13  14  147 212 223
15  12  12  12  13  13  13  14  13  13  13  13  13  82  201 225
14  12  12  12  13  13  12  14  13  13  13  12  13  71  200 225
15  12  12  12  12  13  12  14  13  13  12  12  13  74  200 225
15  12  12  12  13  13  12  14  13  13  13  13  13  74  200 225
14  12  12  12  13  13  12  13  13  13  13  13  13  74  201 224
14  12  12  12  12  13  12  14  13  13  13  13  13  75  200 225

Folks interested in doing line-following can safely start using this as an input dataset (at least for detecting where the line is, and suggesting a correction). To generate more data, log in to the bone and run:

$ cd ~/bot/os/fs/bot/setup/
$ sudo ./setup_all.sh
$ cd ~/bot/
$ sudo python -m hardware.ir_hub

In summary, we have at least one sensor ('front') working pretty much as expected (time delay after each ADC select is currently 10ms, but it can probably be reduced with some testing); one array ('right') is correctly configured as far as order of values are concerned, but shows duplicate values and intermittent read failures; 'left' is always low (14 +/- 1) no matter where I move it; and 'back' is still out (possible chip failure). I believe this validates the overall approach and makes a strong case for ordering those PCBs soon.

The best part is that value separation between black and white is pretty big, a simple threshold at around 128 should give us very reliable binary results. I expect to see about 2-3 sensor units lit up at a time when on a white line.

R00ney commented 10 years ago

Thanks @napratin ! For final validation of the PCBs, I need a last mtg with @jschornick . Are you available anytime Monday or Tuesday afternoon?

Also, @napratin , any idea if the digital out pin is going to be able to be fixed up and used? Found the good threshold voltage it seems, so if we can get the digital pin working that'll be one less step (and far quicker) on the BBB side.

napratin commented 10 years ago

As far as I remember, the digital pins were not giving consistent outputs - i.e. they were 0 or 1 irrespective of the ADC result being low or high, with no detectable pattern of errors (one-off, delayed, etc.). Some further testing is required to establish whether they are going to be useful for our purpose or not. Note that the ADC might be functioning properly, but the GPIO pins on the bone may not be able to support frequent reads like we need (people have been able to get between 3-10kHz, e.g. this post).

One course of action (thinking aloud here...) is to select one known IR sensor on a particular array, and read it repeatedly (GPIO, ADC & Alert Status register) as we expose it to black and white surfaces. Doing this with different read delays, V_HIGH (high threshold) and V_HYST (hysteresis) values might help us narrow down a usable range of operation.

jschornick commented 10 years ago

@R00ney Almost missed this... I haven't been following most of the IR discussions too closely. Still, if you have a board you want a second set of eyes to go over, I should definitely be around tomorrow.

Point me at what you have and any related datasheets (is it the three linked at https://github.com/NCSUhardware/bot/issues/63#issuecomment-29224290 ...?), and let me know when you want to meet.

dfarrell07 commented 10 years ago

@R00ney @jschornick - Have you two had a discussion about PCBs? I don't think we'll be able to place orders over the break (unless we buy them ourselves and then get a reimbursement), but the designs should be ready to be kicked off as soon as next semester starts.

R00ney commented 10 years ago

My apologies for being out of contact. I'll get the eagle cad files posted to a repo under my name some time this weekend.

R00ney commented 10 years ago

Small board posted in https://github.com/R00ney/ir_array_board

I'm considering making a larger version of it, with mounting holes. What do you think jeff?

dfarrell07 commented 10 years ago

Great work @R00ney! Hopefully you and @jschornick can iron out any questions at tonight's meeting. I'd like to place the order ASAP - as soon as we're confident that the designs are good to go.

jschornick commented 10 years ago

I've committed all the CAM and panelization files necessary to make @R00ney's board production ready. We made some minor changes to the circuit to improve the reference voltage, but otherwise the only major change was the addition of mounting holes.

A panel of ten IR array PCBs (5 with mounting holes, 5 without) has been uploaded to Advanced Circuits for verification. If they don't find any show-stopper errors, we can go ahead and put in an order. The student deal is usually $33 for a 6x10" panel, with potentially a $50 setup fee if the panel contains multiple boards. I'll try to find out the details of making an order via an NCSU account tomorrow.

As always, these boards may have a fatal flaw that we missed, rendering them useless. Though it's never something we hope for, we should plan to make a second order of boards if necessary.

jschornick commented 10 years ago

After getting the DFM results from @R00ney's last fix, there was another clearance issue on one of the select lines. I simplified the routing and (hopefully) fixed the clearance issue. A panel with this 3rd version is waiting on what will hopefully be our last verification round. I'll update once I get the DFM results.

Review the relevant layout changes here: https://github.com/R00ney/ir_array_board/commit/1900b87385886108167aa4da64daa626319e6c1d

jschornick commented 10 years ago

Last DFM came back completely clean... so if we're comfortable with the circuit, it should be OK to send the board for manufacture.

dfarrell07 commented 10 years ago

How's the IR array debugging going, @R00ney?

@jschornick - You mentioned following up with the PCB order. Any update on that?

jschornick commented 10 years ago

I left an inquiry earlier today at the number Ricker provided when our order was put on hold, but have yet to hear back. Will try again after lunch (mountain time).

Whoever placed the order would have the login details to check this information on the 4pcb.com website.

@R00ney, @rlsnow -- does the NCSU purchaser have the login information to check our order? All I have is an order number (51186) to go on.

jschornick commented 10 years ago

UPS tracking (1ZX1002A0345244692) provided by the sales department at Advanced Circuits says the IR boards were delivered to "Morie" on Friday.

rlsnow commented 10 years ago

Shit guys really sorry. They are upstairs and I forgot to grab them... :( Will do ASAP

-Ricker

On Tue, Jan 28, 2014 at 3:04 PM, Jeff Schornick notifications@github.comwrote:

UPS tracking (1ZX1002A0345244692) provided by the sales department at Advanced Circuits says the IR boards were delivered to "Morie" on Friday.

Reply to this email directly or view it on GitHubhttps://github.com/NCSUhardware/bot/issues/63#issuecomment-33518862 .

Ricker Snow North Carolina State University Student, Electrical and Computer Engineering NCSU IEEE Treasurer

dfarrell07 commented 10 years ago

They are upstairs

@rlsnow - Do you by chance know if the WNICs are up there as well?

Shit guys really sorry.

No worries man, we appreciate everything you do for the team.

rlsnow commented 10 years ago

I got an email on 1/23 saying the pcbs had shipped but I never got an email from ECE saying they had been delivered. I did get an email from Don Morie saying the order from Amazon had been delivered. Will check tomorrow assuming staff will be around.

-Ricker

On Tue, Jan 28, 2014 at 4:33 PM, Daniel Farrell notifications@github.comwrote:

They are upstairs

@rlsnow https://github.com/rlsnow - Do you by chance know if the WNICshttp://www.amazon.com/dp/B002WBX9C6are up there as well?

Shit guys really sorry.

No worries man, we appreciate everything you do for the team.

Reply to this email directly or view it on GitHubhttps://github.com/NCSUhardware/bot/issues/63#issuecomment-33528539 .

Ricker Snow North Carolina State University Student, Electrical and Computer Engineering NCSU IEEE Treasurer

rlsnow commented 10 years ago

Grabbed all that stuff today so check the lockers. Daniel, they also gave me a packet for you from fingertech. It's with everything else in a white ups bag.

-Ricker

On Jan 28, 2014, at 4:33 PM, Daniel Farrell notifications@github.com wrote:

They are upstairs

@rlsnow - Do you by chance know if the WNICs are up there as well?

Shit guys really sorry.

No worries man, we appreciate everything you do for the team.

— Reply to this email directly or view it on GitHub.

R00ney commented 10 years ago

Sorry for not responding earlier. With the weather days (ie no one else coming in), and a large HW I had due tonight, and especially with the new boards coming in, I decided to save effort and focus on building the boards and implementing those on the bot tomorrow.

dfarrell07 commented 10 years ago

As a general update, the PCBs seem to work wonderfully. Neal has them all installed on the bot. We need to confirm that the two new ones come up with i2cdetect and resolve #86, then this issue will be done (yay!).

dfarrell07 commented 10 years ago

Over-the-top happy to finally close this issue. We're now able to read all IR array perfectly, even from the Android interface. Great job @R00ney!