Issues and Solutions

A project log for Voight-Kampff Machine

Distinguishing Humans from Replicant's

Tom MeehanTom Meehan 03/13/2017 at 17:300 Comments

Mechanical issues encountered and solved (mostly):

Biggest mechanical issue has been with my 3D Printer – one of the nuts on my Z-axis lead screws became stripped out. It took awhile to determine this was the issue (initially looked like a failure in the coupling of the lead screw to the stepper motor) and once I did figure it out I had to find a replacement nut, disassemble and re-assemble the printer, and then re-level and re-calibrate the whole thing. This obviously held me up in prototyping test parts but it is fixed and working better than ever now.

Extension arm – currently testing 1/4” aluminum cylindrical extrusion (sounds technical but I got it off the shelf at Menards). Have found that it is “nominally” 1/4”, but is actually a bit larger than that. Came into play when testing a 1/4” I.D. nylon bushing – by itself it worked, but when inserted into a wood block it was to tight for the rod, even after running a 1/4” drill bit through it. So, switched to some Delrin – drilled a 1/4” hole through a 3/4”x3/4”x3/4” cube – better but still tight. Sanded down the lower section of the 1/4” aluminum rod with 400-600 grit sand paper – now it slides in and out smoothly.

Servo motors – primarily the motor to extend the arm, needed more torque and metal gears – solved (SG-90 servo's from TowerPro). Encountered one new issue with the servo for arm extension – I incorrectly thought that the servo would rotate more than 180 degrees. I was able to fix this by converting the servo motor into a continuous rotation gear motor ( Adafruit guide to modifying servo for continuous rotation ). I will need to add limit switches to mark the endpoints of the travel of the arm.

Raising the arm - continuing to test motors for raising the arm on the VK. None of the Servo's I have on hand are strong enough (high enough torque) and they stall under the tests I've tried. The same goes for all but the largest of the geared motors that I have on hand. I finally put together a test rig for my largest geared motor only to find that it had insufficient torque at lower speeds (controlling with PWM and a L293 H-Bridge). I ended up having to order a NEMA 17 stepper motor with a planetary gearbox (5:1 reduction), torque ratings look more than sufficient. I should receive it by Wednesday this week.

Sensor Issues solved and working on:

PulseOx sensor (MAX30100) – surface mount pads are just too small for me (since I'm just a beginner with surface mount components). I've etched multiple breakout boards (pics below) but have been unsuccessful at making an actual working board, the pads on the surface mount package are just to small for me (I've only just started using SMD components). I decided it would just be easier to buy a commercial module, the MAXREFDES117 (it uses the MAX30102 PulseOx sensor and comes with sample code for the Arduino).

After receiving the MAXREFDES117 I soldered some header pins on to connect it up. Downloaded the code from Maxim Integrated, opened it up in my Arduino IDE and tried compiling it... a no go, it threw a bunch of errors and would not compile. Looking through all the header files I found that I needed to change the pin and port assignments the the I2C interface to work correctly. I did all that but still it wouldn't compile. Then I figured I might need to update my IDE – turns out it was a bit old (I was using 1.6.4 while the newest is 1.8.1). After updating everything I opened the new IDE, loaded up the example sketch and tried again to compile – it still failed. After some online searching and watching some videos by Maxim Integrated I could not find any comments by anyone using this module with an Arduino.

Finally I decided to reach out to Maxim Integrated Support and emailed them about my problems with getting the module to work with their sample code. I did receive a reply back stating that they tested the sample code and experienced the same issues that I had and they are looking into a solution.

Before hearing back from Maxim I thought that I'd try and see if there was any other code anywhere for Maxim's pulse ox sensor. Finally, I stumbled across a library on Github, posted by Sparkfun Electronics. The library is not specific for this module but is supposed, or expected, to work with any of the MAX3010x family of sensors. I downloaded, unzipped and opened the code in the Arduino IDE, it actually compiled on the first attempt. So, I wired everything up according to the Sparkfun code and uploaded the sketch... it actually works!!!

After alerting Maxim to the issues I encountered with code for the MAXREFDES117 (optical pulse/ox sensor) not compiling they suggested the following fixes to the code:

In File: RD117_ARDUINO\SoftI2CMaster.h
Change the lines:

bool __attribute__ ((noinline)) i2c_start(uint8_t addr);
bool __attribute__ ((noinline)) i2c_rep_start(uint8_t addr);
void __attribute__ ((noinline)) i2c_stop(void) asm("ass_i2c_stop") ;
bool __attribute__ ((noinline)) i2c_write(uint8_t value) asm("ass_i2c_write");
uint8_t __attribute__ ((noinline)) i2c_read(bool last);
void __attribute__ ((noinline)) i2c_delay_half(void) asm("ass_i2c_delay_half") ;
void __attribute__ ((noinline)) i2c_wait_scl_high(void) asm("ass_i2c_wait_scl_high") ;
Change to:
bool __attribute__ ((noinline)) i2c_start(uint8_t addr)__attribute__((used));
bool __attribute__ ((noinline)) i2c_rep_start(uint8_t addr)__attribute__((used));
void __attribute__ ((noinline)) i2c_stop(void) asm("ass_i2c_stop") __attribute__((used));
bool __attribute__ ((noinline)) i2c_write(uint8_t value) asm("ass_i2c_write") __attribute__((used));
uint8_t __attribute__ ((noinline)) i2c_read(bool last) __attribute__((used));
void __attribute__ ((noinline)) i2c_delay_half(void) asm("ass_i2c_delay_half") __attribute__((used));
void __attribute__ ((noinline)) i2c_wait_scl_high(void) asm("ass_i2c_wait_scl_high") __attribute__((used));

After making these changes the code now compiles perfectly in the Arduino IDE (1.8.1). This code should work better than the SparkFun code since it includes a more advanced algorithm for determining heart rate.

Non-contact Temperature sensor - I have some concerns regarding my MLX9014 non-contact temp sensor – poor performance at any reasonable distance and limiting field of view is proving difficult. May need to switch to one of TI's sensors.