Debugging…

Many things have gone wrong but I managed to solve some problems by just checking the connections. I also made changes to the program for the communication between the dock and diamond.

I expanded the UI of the dock from the original plan so that it will be less confusing for the user. Previously, there were only two modes: connecting to the diamond and setting the new frequency. I added a function to turn the vibration on or off, and generally just provided more visual feedback in terms of telling the user what is going on with the machine.

After finishing soldering the connections on the dock, I could not get the RF link to work. I checked that the connections were correct and that they were connected, but I just could not seem to find the problem. So, now the diamond is stuck at a single vibrating frequency until I have found and fixed the problem with the code/circuit.

I also forgot to accommodate the fact that changing the power source’s voltage changed the overall conditions for the HIGH/LOW pin reading on the ATtiny. The contact between the copper tapes on the dock and diamond did not provide high enough current for to trigger the HIGH reading on the ATtiny.

Although it seems unlikely that I will solve the issues before submitting this project, I hope to continue working on this until I make a finished product.

In the meantime, here are videos of what I have managed to complete so far…

The UI of the dock:

The diamond in action:

Advertisements
Posted in PC

Putting together the Hardware

Here’s an update with just some work-in-progress images while I was putting together the hardware.

Soldering the components for the diamond: the first try kind of failed because it was so messy while I tried to get all connections to fit on the tiny board. I also forgot to include the capacitor for the motor. The second try was much neater and I got everything right because I had the first one for visual reference.

20170118_123249.jpg
First one without the capacitor.
IMG-20170119-WA0000.jpeg
In the midst of soldering/fitting the connections within the dock.

 

On another note, I found a quick way to remove the copper strip from the board with just solder and pliers:

Posted in PC

Sensing the diamond on the dock

I wanted to make the diamond stop vibrating while it is in the dock, so I’m trying out a method that uses the same principle of the push button. I attached copper tape to the dock and diamond. The circuit works on the breadboard, but in reality, the dock and the diamond do not exactly fit. So, I placed copper tape on all corners to make the connection work and also to make it look nice.

copperTapeDock.jpg

 

copperTapeDiamond.jpg

20170118_150326.jpg
Halving the copper tape…

For the inside of the diamond, I folded the copper tape into half so that both sides will be conductive. Then, I used plastic tape to connect the 6 corners and soldered a wire to one of the corners.

 

When the diamond is placed in the dock, it will close the circuit and the reading of the pin that is linked to between ground and the resistor will be HIGH, otherwise, when there is no diamond, it will be LOW.

Similarly, the copper tape on the diamond is linked to the ATtiny’s input pin. When the diamond is placed on the dock, there will be current flowing through to the pin and the resistor to ground.

 

v3_2.png
Zoomed in circuit diagram on the diamond’s copper tape

 

 

Posted in PC

Designing the diamond and the dock

I was using Blender to make the first 3D model draft, but switched to Fusion360 (because it was easier). A draft of the diamond (which will be produced of different materials such as wood and plastic, for now) model and the dock:

The challenge is in getting all my components to fit in the cases without sacrificing too much of the aesthetics. The diamond should be palm-sized or smaller, and I wanted the dock not to have too much extra space around the diamond.

After a few iterations to get things right, the diamond was milled in wood and 3D printed, while the dock was 3D printed in parts to reduce the time spent if there was any error printing mid-way.

diamond

Below is the 3D model I did in fusion360. I sliced the diamond to make it flat and millable by the CNC milling machine.diamond_model_final

The 3D printed one:

20170120_212342.jpg

From learning to prepare the model and operate the machine to milling the actual thing took me three full working days. I milled using a practice material (some sort of green hard foam board that I got from the lab tech, Konstantine). I plan to mill another diamond out of acrylic if I can get the diamond and dock to work well in time.Here’s part of the wooden diamond milled by the machine:

20170120_212318.jpgPrototype.

milleddiamond

Dock (3D model ) including a knob for the potentiometer and two buttons ‘enter’ and ‘back’:

dock_model_final

I had to reprint the button and knob a few times because the actual size deviated a little and it wouldn’t fit.

Posted in PC

Got the Manchester library working + RF communication scheme

After re-installing the libraries and switching to the Arduino IDE 1.06, I managed to get the ATtiny85 to transmit a short array of characters to the receiver attached to the Arduino UNO.

Previously, I was having problems with getting the receiver to receive any meaningful data, but I think the problem might have been because of omitting the following line in the code which was only needed if the ATtiny85 was working on 1Mhz internal clock.

man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84

I was very sure I had burned the bootloader to 8Mhz, but for some unknown reason, it just needed that line of code. After that, it worked, as shown in this video of LED lights lighting up in sync:

 

The problem with using RF is that the data sent is received by all receivers of the same frequency. The receivers and transmitters that I have were all 413Hz, so I drafted up with this communication scheme that would help me communicate with the right diamond:

arrays
------
format of arrays: `[char1, char2, checksum]`

where `checksum = (((dec(char1)*dec(char2))*13)%8+81`

correct array: `['A', 'G', 'M']`


"A" --> 65
"G" --> 71
checksum = 84 --> "T"

---
table of codes
--------------
A (65) - identity

B (66) - identity

C (67) - identity

D (68) - identity

E (69) - identity

F (70) - identity

G (71) - frequency1 (Min working voltage)

H (72) - frequency2

I (73) - frequency3

J (74) - frequency4

K (75) - frequency5

L (76) - frequency6

M (77) - frequency7

N (78) - frequency8

O (79) - frequency9

P (80) - frequency10 (Max working voltage)

Q (81) - switch on/off

R (82) - checksum

S (83) - checksum

T (84) - checksum

U (85) - checksum

V (86) - checksum

W (87) - checksum

X (88) - checksum

Y (89) - checksum

Z (90) - affirmative

---
algorithm for communication between diamond and dock
----------------------------------------------------
##diamond

diamond idle state:
transmit '[identification, frequency, checksum]' (2 seconds) --> receive (2 seconds) (repeatedly).
if receive same array as transmitted:
transmits [identification, affirmative, checksum] and goes to setting state.

diamond setting state:
stops transmitting for 20 seconds (only receives).
if receives [identification, frequency, checksum]:
sets new frequency and resets timer for 20 seconds.
else if 20 seconds is up:
goes to idle state.

##dock

dock (on menu for changing frequency) idle state:
only receives
if receives correct array:
goes to setting state.


dock (on menu for changing frequency) waiting state:
transmits same array once --> wait to receive affirmative (1 second) (repeatedly for 3 seconds)
if received affirmative: 
goes to setting state.
else if 3 seconds is up without receiving affirmative:
goes to idle state.

dock (on menu for changing frequency) setting state:
user can select new frequency, transmits [identification, new frequency, checksum]
if send affirmative to diamond (to exit):
goes to idle state.

And I got the RF to send bytes:

COM4 6_12_2016 10_09_15 PM.png

Posted in PC

Making the Manchester library work: Arduino-tiny

I decided to first try out the Manchester library as there were more resources on this compared to TinySafeBoot.

I managed to get the ATtiny chip working without much effort by following highlowtech’s instructions, except for the part where the Arduino ISP example code needs to be uploaded to the Arduino board first before even attempting to do anything to the ATtiny. A slew of errors followed while I tried to get the Manchester library to work.

#include "Manchester.h"

#define TX_PIN 0 //pin where your transmitter is connected
uint16_t transmit_data = 2761;

void setup() {
man.setupTransmit(TX_PIN, MAN_1200);
}

void loop() {
man.transmit(transmit_data);
delay(200);
}

I was trying to compile the simple code above. After adding the Manchester library to the code, there was an error that was outlined in this forum. The package I was using attiny is missing an option required to allow the Manchester library to function properly on ATtinyX5 (ATtiny25, 45, 85) devices, specifically the definition of __AVR_ATtinyX5__ when a device is selected. The solution was to use Arduino-tiny core instead.

Then I had this error while compiling: "avr-g++": executable file not found in %PATH%

I am using the Arduino.cc IDE 1.6.11, but many of the solutions I found online were for older versions of the IDE and did not work. After scouring the web, I found this Technoblogy post to be the solution I was looking for. It is probably because it might be the latest write-up on getting the Arduino-tiny to work.

Posted in PC

Wireless Communication Between ATtiny85 & Arduino Uno

To alter the vibration rate/frequency in the Diamond, I could either build a physical connection between the Dock and the Diamond or use radio frequency as a wireless communication between Arduino Uno and ATtiny85. The former would need some serious product design knowledge and would most possibly pose problems when it comes to building it, but the latter will solve the need to build a physical connection between the Diamond and Dock.

I found 2 methods for wireless communication:

  1. Manchester Library
  2. TinySafeBoot

The first method requires some extra hardware, an RF receiver and transmitter module, while the second one is a bootloader designed for ATtinys and ATmegas.

More about TinySafeBoot here: https://ladvien.github.io/robots/tsb/

 

Posted in PC