{"id":1557,"date":"2015-09-22T06:23:52","date_gmt":"2015-09-22T05:23:52","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=1557"},"modified":"2015-09-26T06:30:15","modified_gmt":"2015-09-26T05:30:15","slug":"project-136-thermal-imager-project-update-7-flir-lepton-arduino-due-integration-part-2","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/project-136-thermal-imager-project-update-7-flir-lepton-arduino-due-integration-part-2\/","title":{"rendered":"Project 136: Thermal Imager Project Update 7: FLIR Lepton + Arduino Due Integration Part 2"},"content":{"rendered":"<p>I have made some progress with the integration of the Lepton Module wth the Arduino Due. I found out that I was wiring Sda and Scl to the wrong pins of the Due board, I should have had them wired to Pinds 20 and 21, and I was wiring them to the &#8220;SCL1&#8221; and &#8220;SDA1&#8221; pins.<\/p>\n<p>I can now get the Serial numbers and setup information out of the lepton, such as:<\/p>\n<blockquote><p>beginTransmission<br \/>\nreg:2==0x6 binary:110<br \/>\nSYS Camera Customer Serial Number<br \/>\nreg:2==0x7 binary:111<br \/>\nbusy<br \/>\nreg:2==0x6 binary:110<br \/>\nreg:6==0x20 binary:100000<br \/>\npayload_length=32<br \/>\nFFFFFF7E<br \/>\nFFFFB57F<br \/>\n5D5E<br \/>\n5CFD<br \/>\nFFFFF4D7<br \/>\nFFFFD7EB<br \/>\nFFFF96F5<br \/>\n7D47<br \/>\nFFFFDCD7<br \/>\n7570<br \/>\n55F9<br \/>\n7CFF<br \/>\n5CFF<br \/>\nFFFFDEEB<br \/>\n3D94<br \/>\nFFFFD55C<br \/>\nSYS Flir Serial Number<br \/>\nreg:2==0x7 binary:111<br \/>\nbusy<br \/>\nreg:2==0x6 binary:110<br \/>\nreg:6==0x8 binary:1000<br \/>\npayload_length=8<br \/>\nFFFFF017<\/p><\/blockquote>\n<p>However I am still getting garbled data over the SPI bus. I can&#8217;t seem to get it to work at all, no matter what I try. Is there anything obvious that I could be missing here?<\/p>\n<p>In an attempt to make my code as simple as possible, I created this sketch:<\/p>\n<blockquote><p>#include &#8220;SPI.h&#8221;;<\/p>\n<p>int data[164];<\/p>\n<p>void setup()<br \/>\n{<br \/>\nSerial.begin(9600);<\/p>\n<p>pinMode(10, OUTPUT);<\/p>\n<p>SPI.setDataMode(SPI_MODE3);<br \/>\nSPI.setClockDivider(0);<br \/>\nSPI.begin();<\/p>\n<p>Serial.println(&#8220;setup complete&#8221;);<br \/>\ndelay(1000);<\/p>\n<p>for (int i = 0; i &lt; 164; i++) {<br \/>\ndigitalWrite(10, LOW);<br \/>\nint response1 = SPI.transfer(0xFF);<br \/>\ndata[i] = response1;<br \/>\ndigitalWrite(10, HIGH);<\/p>\n<p>}<\/p>\n<p>for (int i = 0; i &lt; 164; i++) {<br \/>\nint response1 = data[i];<br \/>\nSerial.print(i);<br \/>\nSerial.print(&#8221; &#8220;);<br \/>\nSerial.println(response1);<br \/>\n}<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\n}<\/p><\/blockquote>\n<p>But I am just getting a string of mostly 0&#8217;s, with some other numbers in there.<\/p>\n<p>I am making progress, I aim to have a simple thermal scanner prototype working this week.<\/p>\n<p>The images below are of the FLIR Lepton Camera, and the camera wired up (correctly, as far as I know) to the Due.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0685.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1556\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0685-300x225.jpg\" alt=\"DSC_0685\" width=\"300\" height=\"225\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0685-300x225.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0685-1024x768.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0685.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0695.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1555\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0695-300x225.jpg\" alt=\"DSC_0695\" width=\"300\" height=\"225\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0695-300x225.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0695-1024x768.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0695.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a> <a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0693.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1554\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0693-300x225.jpg\" alt=\"DSC_0693\" width=\"300\" height=\"225\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0693-300x225.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0693-1024x768.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2015\/09\/DSC_0693.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have made some progress with the integration of the Lepton Module wth the Arduino Due. I found out that I was wiring Sda and Scl to the wrong pins of the Due board, I should have had them wired to Pinds 20 and 21, and I was wiring them to the &#8220;SCL1&#8221; and &#8220;SDA1&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[],"class_list":["post-1557","post","type-post","status-publish","format-standard","hentry","category-inventions","category-tutorials","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1557"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=1557"}],"version-history":[{"count":5,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1557\/revisions"}],"predecessor-version":[{"id":1582,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1557\/revisions\/1582"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}