<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org">
  <id>tag:dreamwidth.org,2009-04-20:105601</id>
  <title>Busy hands | Disquiet mind</title>
  <subtitle>Craft and Tech Notebook</subtitle>
  <author>
    <name>chebe</name>
  </author>
  <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom"/>
  <updated>2025-03-19T14:40:57Z</updated>
  <dw:journal username="chebe" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:160808</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/160808.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=160808"/>
    <title>MPU-6050 Arduino libraries code archaeology</title>
    <published>2025-03-19T12:36:48Z</published>
    <updated>2025-03-19T14:40:57Z</updated>
    <category term="maths"/>
    <category term="accelerometer"/>
    <category term="code"/>
    <category term="arduino"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">Compare and contrast getting normalized accelerometer values, where the raw value is -13248.00. (A.k.a. Please, make it make sense.)&lt;br /&gt;&lt;br /&gt;Library 1; jarzebski's Arduino-MPU6050 - &lt;a href="https://github.com/jarzebski/Arduino-MPU6050/"&gt;https://github.com/jarzebski/Arduino-MPU6050/&lt;/a&gt;&lt;br /&gt;Library 2; Adafruit's Adafruit_MPU6050 - &lt;a href="https://github.com/adafruit/Adafruit_MPU6050"&gt;https://github.com/adafruit/Adafruit_MPU6050&lt;/a&gt;&lt;br /&gt;Library 3; i2cdevlib/ElectronicCats' mpu6050 - &lt;a href="https://github.com/ElectronicCats/mpu6050"&gt;https://github.com/ElectronicCats/mpu6050&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 1;&lt;/h3&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/160808.html#cutid1"&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_RANGE_2G;&lt;br /&gt;raw * rangePerDigit  * gravityConst&lt;br /&gt;(raw * (1.0/16384)) * gravityConst&lt;br /&gt;== (raw / 16384) * gravityConst&lt;br /&gt;(-13248.00 * .000061) * 9.80665 = -7.92502845&lt;br /&gt;== (-13248.00 / 16384) * 9.80665 = -7.92959589&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 2;&lt;/h3&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___2" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/160808.html#cutid2"&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___2" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_RANGE_2_G;&lt;br /&gt;(raw / accel_scale) * gravityConst&lt;br /&gt;(-13248.00 / 16384) * 9.80665 = -7.92959589&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Library 3;&lt;/h3&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___3" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/160808.html#cutid3"&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___3" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;No normalized functions in MPU6050.cpp. Can use MotionApps files, but they go through Quaternions.&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___4" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/160808.html#cutid4"&gt;code&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___4" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Formula for normalized acceleration value at MPU6050_ACCEL_FS_2;&lt;br /&gt;// jarzebski way;&lt;br /&gt;raw * accelerationResolution * gravityConst&lt;br /&gt;-13248.00 * 0.000122 * 9.80665 = -15.850057&lt;br /&gt;&lt;br /&gt;// adafruit way;&lt;br /&gt;// (raw * (1.0/16384)) * gravityConst&lt;br /&gt;// (raw * (2.0/16384)) * gravityConst&lt;br /&gt;(-13248.00 / (2.0*16384)) * 9.80665 = -15.85919&lt;br /&gt;((-13248.00*2.0) / 16384) * 9.80665 = -15.85919&lt;br /&gt;&lt;br /&gt;Result is twice that of the others. &lt;code&gt;accelerationResolution&lt;/code&gt; itself seems to be twice the others, so half it? Not sure if this is a mistake, or I'm missing something about MPU6050_ACCEL_FS_2 vs MPU6050_RANGE_2_G.&lt;br /&gt;raw * (accelerationResolution/2) * gravityConst&lt;br /&gt;-13248.00 * (accelerationResolution/2) * 9.80665 = -7.9250&lt;br /&gt;&lt;br /&gt;&lt;code&gt;accelerationResolution&lt;/code&gt; and &lt;code&gt;get_acce_resolution()&lt;/code&gt; only exist in the ElectronicCats version, they're not accessible in the &lt;a href="https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050"&gt;i2cdevlibs&lt;/a&gt; version. That version seems to &lt;strong&gt;really&lt;/strong&gt; want you to use the Quaternion path. But you can always use the range values from the other versions yourself on the raw values.&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=160808" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:160644</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/160644.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=160644"/>
    <title>MPU-6050 with Arduino and Processing, data visualization code archaeology</title>
    <published>2025-03-17T15:50:50Z</published>
    <updated>2025-03-19T00:00:42Z</updated>
    <category term="code"/>
    <category term="accelerometer"/>
    <category term="arduino"/>
    <category term="processing"/>
    <category term="gyroscope"/>
    <category term="photos"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">The MPU-6050 is an accelerometer and gyroscope (with added thermometer), that contains a Digital Motion Processor (DMP) to handle a lot of the heavy maths lifting of turning the raw sensor values into useful motion values before they reach the microcontroller. It seems (caveat; I'm new to this area) that the original code is only available as a binary, or as some demo code. But some very determined people have pulled a library together.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;/* Source is from the InvenSense MotionApps v2 demo code. Original source is
 * unavailable, unless you happen to be amazing as decompiling binary by
 * hand (in which case, please contact me, and I'm totally serious).
 *
 * Also, I'd like to offer many, many thanks to Noah Zerkin for all of the
 * DMP reverse-engineering he did to help make this bit of wizardry
 * possible.
 */&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Well, actually, it seems quite a lot of people have pulled libraries together, to different levels of functionality, with very similar names. But the one most people seem to use is &lt;a href="https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050"&gt;this one&lt;/a&gt;. Which includes the MotionApps files. This is important, not just for the right function calls, but because you need other libraries from &lt;a href="https://github.com/jrowberg/i2cdevlib/tree/master/Arduino"&gt;this collection&lt;/a&gt; as well, particularly the &lt;a href="https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/I2Cdev"&gt;I2Cdev one&lt;/a&gt;. These libraries, although for Arduino, are &lt;strong&gt;not&lt;/strong&gt; findable inside the Arduino IDE's Library Manager. You need to side-load them, old school style. Which means downloading and extracting the .zip file. Then copying the specific libraries (being the folders that contain an 'Examples' folder as a first level child) for MPU6050 and I2Cdev into your Arduino &amp;gt; libraries folder. And restarting the IDE.&lt;br /&gt;&lt;br /&gt;(I've also, after the fact, found what seems to be a copy of the MPU6050 library in an &lt;a href="https://github.com/ElectronicCats/mpu6050"&gt;ElectronicCats repo&lt;/a&gt;, that is in the Library Manager, and seems to have rolled the I2Cdev code into itself. But the oldest change here seems to be 6 years ago. Whereas the i2cdevlib seems to be about 13 years ago. It does seem to have more recent updates than i2cdevlib though. So the choice is yours. I'm telling you, it's a nightmare finding what's what, especially when the code linking to it won't even compile with it.)&lt;br /&gt;&lt;br /&gt;To help us get a feel for how the boards movements are interpreted, there's a nice demo we can try out. You can find the MPUTeapot Processing project inside the MPU6050 Arduino library; MPU6050 &amp;gt; examples &amp;gt; MPU6050_DMP6 &amp;gt; Processing &amp;gt; MPUTeapot.&lt;br /&gt;&lt;br /&gt;First step is to install Processing. I'm using P4. Copy that MPUTeapot.pde file into a new sketch (or the whole folder to wherever you save your sketches). This sketch requires another stack of libraries, the &lt;a href="https://github.com/postspectacular/toxiclibs/releases"&gt;Toxi/c libraries&lt;/a&gt;, which we need to side-load again. Download the newest release, extract the .zip file, and copy the libraries (being the folders that contain an 'examples' folder as a first level child) into your Processing &amp;gt; Libraries folder. Restart Processing.&lt;br /&gt;&lt;br /&gt;&lt;p class="image" style="text-align:center;"&gt;&lt;a href="https://lostaurora.net/gallery/galleries/blog2025/20250317_MPU6050Circuit_bb.png"&gt;&lt;img width="503" alt="Illustration of Arduino Mega board wired up to MPU6050 board as described below." src="https://lostaurora.net/gallery/galleries/blog2025/20250317_MPU6050Circuit_bb.png" border="0"&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;MPU6050 Circuit&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Made with &lt;a href="http://fritzing.org/home/"&gt;Fritzing&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Wire up your MPU6050 to your Arduino (I'm using the Mega 2560). You need to connect the Interrupt pin to Digital pin 02 (on most Arduino boards). SDA -&amp;gt; SDA. SCL -&amp;gt; SCL. VCC -&amp;gt; 5V. GND -&amp;gt; GND.&lt;br /&gt;&lt;br /&gt;Open the MPU6050 &amp;gt; MPU6050_DMP6 example, and load it onto your Arduino. By default it runs in readable yaw-pitch-roll mode. Open the Serial Monitor at 115200 baud. After finding and initialising your MPU6050 it will await char input. Send any char, and you'll get a lot of lines like;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;DMP ready! Waiting for first interrupt...
ypr	0.01	-0.01	0.44
ypr	0.01	-0.01	0.44
ypr	0.01	-0.01	0.44
ypr	0.01	-0.01	0.43&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;Which are your yaw-pitch-roll Euler angles in degrees.&lt;br /&gt;&lt;br /&gt;If you comment out the &lt;code&gt;#define OUTPUT_READABLE_YAWPITCHROLL&lt;/code&gt; line, and uncomment the &lt;code&gt;#define OUTPUT_TEAPOT&lt;/code&gt; line you'll prepare the code for use with the Processing demo. Instead of nice readable yaw-pitch-roll values the info is packed into a 42-byte FIFO packet buffer; [quat w][][quat x][][quat y][][quat z][][gyro x][][gyro y][][gyro z][][accl x][][accl y][][accl z][][]. Upload to your Arduino.&lt;br /&gt;&lt;br /&gt;Moving over to Processing now, open the MPUTeapot demo. I find it nostalgic that this is running in OpenGL mode. If you want to increase the window size, go ahead and do that. Otherwise you just need to set the correct &lt;code&gt;portName&lt;/code&gt;. For me that meant commenting out line 72, and uncommenting line 75, while updating line 75 to say &lt;code&gt;"COM7"&lt;/code&gt;. The demo is straight-forward, handling the drawing of the virtual plane, reading and unpacking the packets back to quaternion w,x,y,z values, and handing off the complications to the Toxi/c libraries. But when it works it's a lot of fun to manipulate the virtual plane by moving your MPU6050. And really helps you connect the board movement to what you want your project to detect/react to, in your mind.&lt;br /&gt;&lt;br /&gt;&lt;p class="image" style="text-align:center;"&gt;&lt;a href="https://lostaurora.net/gallery/galleries/blog2025/20250317_MPUTeapotDemo.gif"&gt;&lt;img width="284" alt="Animation of a block plane (red board, green wings and tail fin, blue nose cone) rotating in 3D space." src="https://lostaurora.net/gallery/galleries/blog2025/20250317_MPUTeapotDemo.gif" border="0"&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;MPUTeapot demo&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Gif by &lt;span style='white-space: nowrap;'&gt;&lt;a href='https://chebe.dreamwidth.org/profile'&gt;&lt;img src='https://www.dreamwidth.org/img/silk/identity/user.png' alt='[personal profile] ' width='17' height='17' style='vertical-align: text-bottom; border: 0; padding-right: 1px;' /&gt;&lt;/a&gt;&lt;a href='https://chebe.dreamwidth.org/'&gt;&lt;b&gt;chebe&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=160644" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:122524</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/122524.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=122524"/>
    <title>Accelerometer data to RGB</title>
    <published>2020-07-25T09:16:01Z</published>
    <updated>2025-01-20T19:52:40Z</updated>
    <category term="videos"/>
    <category term="flora"/>
    <category term="accelerometer"/>
    <category term="leds"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">The &lt;a href="https://www.sparkfun.com/products/9267"&gt;LilyPad Accelerometer (ADXL335)&lt;/a&gt;. I've been trying to &lt;a href="https://chebe.dreamwidth.org/5975.html"&gt;use this&lt;/a&gt; for over ten years. Turns out I've misunderstood what it measures for 10 years. I had partial success with just the x-axis using &lt;a href="https://chebe.dreamwidth.org/10676.html"&gt;Leah Buechley's code&lt;/a&gt;, but it has since disappeared, so I can't even be sure what it did.&lt;br /&gt;&lt;br /&gt;I was trying to do something else, and the numbers, very strangely kept coming out to an exact 100.0, which is very wrong. So I went back to make sure the accelerometer was giving me a full value range. Which it didn't seem to be, so I went researching and found &lt;a href="https://lastminuteengineers.com/adxl335-accelerometer-arduino-tutorial/"&gt;this excellent tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Although the accelerometer gives you raw values between 0 and 1023 on an analog read, it actually measures gravity acting on it as it moves around in 3D space. Converting the raw to Gs is straight-forward;&lt;br /&gt;&lt;code&gt;long xAcceleration = map(xRawPinValue, 0, 1023, -3.0, 3.0);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To then turn this into a colour, simply, you could map the range onto -255 to +255 (the polarity demonstrating direction of change), and then reducing that to just value of change;&lt;br /&gt;&lt;code&gt;int xRed = map(xAcceleration, -3.0, 3.0, -255, 255);&lt;br /&gt;int absoluteXRed = abs(xRed);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Do the same for the y and z. Write to RGB LED/pixel of your choice. (Warning; movement in video is quite sudden.)&lt;br /&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/122524.html#cutid1"&gt;Short video&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Sorry for the rough prototype version, I dismantled the &lt;a href="https://chebe.dreamwidth.org/78179.html"&gt;version I made up&lt;/a&gt; for parts to make my &lt;a href="https://chebe.dreamwidth.org/89718.html"&gt;tiara&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Other than light-up gloves, this could be used for rough gesture control, but doesn't give me the kind of information I needed for the thing I was trying to do as is.&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=122524" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:78179</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/78179.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=78179"/>
    <title>LilyPad accelerometer RGB gauntlets, in progress</title>
    <published>2013-10-08T12:58:00Z</published>
    <updated>2019-01-13T20:56:47Z</updated>
    <category term="accelerometer"/>
    <category term="leds"/>
    <category term="projects"/>
    <category term="lilypad"/>
    <category term="photos"/>
    <dw:mood>busy</dw:mood>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">Sorry it's been so quiet around here, things have been hectic in the analogue world. And to top it all off I'm running a series of four workshops on the LilyPad in TOG, starting &lt;a href="http://www.tog.ie/2013/09/workshop-intro-to-lilypad/"&gt;Thursday&lt;/a&gt;. More hours in each day would come in handy right about now.&lt;br /&gt;&lt;br /&gt;But, I haven't been idle. Remember way back when I made a simple &lt;a href="http://chebe.dreamwidth.org/10676.html"&gt;accelerometer glove&lt;/a&gt;? Well, I'm working on a more elaborate matching pair now. &lt;a href="http://partfusion.com/"&gt;PartFusion&lt;/a&gt;, a guy from the hackerspace, makes some really intense &lt;a href="https://www.tindie.com/products/PartFusion/sew-rgb/"&gt;RGB daisy-chainable, sewable, LEDs&lt;/a&gt;. Armed with these, Adafruit's &lt;a href="https://github.com/adafruit/Adafruit_NeoPixel"&gt;NeoPixel library&lt;/a&gt;, a couple of accelerometers, LilyPad Simple boards, and LiPo batteries, I had the fixings of something strong enough to help land planes.&lt;br /&gt;&lt;br /&gt;I used some material from a free tshirt I acquired at some point, made a couple of armwarmers/gauntlets, with inside lining/pouch for the LilyPad Simple board itself. Some metal snaps and lots of conductive thread sewing later I've one strip done. It's still a work in progress, but I brought them along to one of the &lt;a href="http://coderdojodcu.com/sessions/girls/"&gt;CoderDojo&lt;/a&gt; sessions, and people seemed to like them. I have a deadline for them, a concert I have tickets for, so hopefully they'll get finished soon.&lt;br /&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/78179.html#cutid1"&gt;Few photos&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=78179" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:10676</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/10676.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=10676"/>
    <title>The Lilypad Saga Continues</title>
    <published>2010-01-07T20:24:32Z</published>
    <updated>2025-01-20T19:33:25Z</updated>
    <category term="lilypad"/>
    <category term="videos"/>
    <category term="projects"/>
    <category term="accelerometer"/>
    <category term="leds"/>
    <category term="software"/>
    <dw:security>public</dw:security>
    <dw:reply-count>2</dw:reply-count>
    <content type="html">My Lilypad is now aware! It actually does something in response to changes it detects! I can't take the glory, I simply used the code from the project that inspired mine: &lt;a target="_blank" href="http://web.media.mit.edu/~leah/LilyPad/build/accelero_shirt.html"&gt;Leah Buechley's accelerometer shirt&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Interesting things about this code:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/10676.html#cutid1"&gt;Code talk...&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;The Result:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___2" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/10676.html#cutid2"&gt;Short video...&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___2" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Also, there is a newer version of the &lt;a target="_blank" href="http://arduino.cc/en/Main/Software"&gt;Arduino IDE available&lt;/a&gt;, 17, that fixes the bug I mentioned in a previous post about how the Lilypad was using the wrong baud rate to communicate back to the computer. So now if you set it at 9600, it actually uses 9600. This makes me happy.&lt;br /&gt;&lt;br /&gt;Next step? Using data from the 3-axes!&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=10676" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-20:105601:5975</id>
    <link rel="alternate" type="text/html" href="https://chebe.dreamwidth.org/5975.html"/>
    <link rel="self" type="text/xml" href="https://chebe.dreamwidth.org/data/atom/?itemid=5975"/>
    <title>Getting there...</title>
    <published>2009-09-15T19:26:45Z</published>
    <updated>2019-01-13T18:31:04Z</updated>
    <category term="projects"/>
    <category term="lilypad"/>
    <category term="photos"/>
    <category term="accelerometer"/>
    <category term="conductive thread"/>
    <category term="leds"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">The physical construction of my Arduino Lilypad glove is almost complete. Just have to tighten the fit, finish a few edges. I was going to line, decorate, and all that jazz, but feel it's a bit unnecessary for this project. I am getting usable information in, and just have to decide what way I want to use that information, as in, how I want the lights to behave in relation to movement. Here's the glove:&lt;br /&gt;&lt;br /&gt;&lt;span class="cut-wrapper"&gt;&lt;span style="display: none;" id="span-cuttag___1" class="cuttag"&gt;&lt;/span&gt;&lt;b class="cut-open"&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class="cut-text"&gt;&lt;a href="https://chebe.dreamwidth.org/5975.html#cutid1"&gt;Some text and pics&lt;/a&gt;&lt;/b&gt;&lt;b class="cut-close"&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style="display: none;" id="div-cuttag___1" aria-live="assertive"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Things I learned:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;- Analog sensors give you a value between 0 and 1023, which represents the level of current flowing through it. Not anything useful like an absolute temperature, sound level, or angle. You have to work these things out yourself, with a thermometer or other measurement device in hand, and seeing what the values correspond to.&lt;br /&gt;&lt;br /&gt;- Analog actuators take values between 0 and 255, which I assume represents a level of current?, but that doesn't really matter much. The easiest way to get from sensor data to usable actuator data is to simply divide by 4. This however, doesn't always give you the behaviour you desire.&lt;br /&gt;&lt;br /&gt;- Accelerometers also require &amp;#43; and - lines. If you can't see the markings you need a magnifying glass. It will still seem to work without them hooked up, but you'll get somewhat random data that if plotted looks like a soft wave, sitting at 0 for a bit then increasing over a few values to 1023, where it will sit for a bit before descending over a few values to 0, and repeating.&lt;br /&gt;&lt;br /&gt;- The language you use to program the Arduino is called &lt;a target="_blank" href="http://processing.org/"&gt;Processing&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;- Getting data from the Serial object is quite simple. For the regular Arduino if you specify the transfer rate Serial.begin(9600) it comes through on baud 9600. However, for some reason the Lilypad when set at 9600 comes in at 19200. If set at 4800 comes in at 9600. Don't know why. Yet.&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=chebe&amp;ditemid=5975" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
