Week 10 - Make a Machine!

So this week we have to make a machine as a group. This sound extremely challenging, so hopefully it all works out.

I decided to be one the electronics side of things since a lot of people were interested in steering clear of this subgroup. I mainly am interested in learning electronics in this class, so is more beneficial any way.

For the machine, we decided to make a automated alcoholic or non-alcoholic drink despenser. One that is capable of mixing a drink with multiple beverages together to make a mixed drink. I decided the take on the mixing component as my involvment.

In the intial design, we wanted to use a circular cup holder to be tether to a DC motor off axis. This would cause the cup to shake in a circular fashion.

So I started making the board to control the DC motor. Essentially I modeled after the design of Neil board.

In addition, I also added a pin to controll LEDs to change the lights when the motor was on for added effect.

Lastly, we wanted this to be controlled by another master board, so programed another pin to read when a voltage enters the board.

Adding all these extra lines became extremely challening on a one sided board, so I had to add a lot of 0 ohm resistors to hop over lines. trying to incorporate the pins for the LED became really troublesome, so I just decided to manually wire them in.

After making the board, I realized that I was having issues with the input controlling the board. The board would go off on its own if I brought my hands close to the electronic components.

This was an issue Neil mentioned previously, which he said turning on the pull-up resistor on the board would solve this problem. Unfortunately, I tried this, and actually had more unintended on states than without the pull up resistor.

Thus, I decided to keep the pull-up resistor no on. Instead, I wanted to get the value of the voltage input to the pin. This is easy in arduino, since there is a simple command for it, but programming in C was a little bit more challenging. I found this code that I ended up adding to the C program.

void board_init(void); uint16_t get_ADC_sample(void); uint16_t get_ADC_sample(void) { // start a conversion by setting the ADSC bit in ADCSRA ADCSRA |= (1 << ADSC); // wait for the conversion to complete while (ADCSRA & (1 << ADSC)) ; // return the ADC value return(ADC); } /* External interrupt vector */ ISR(EXT_INT0_vect) { // set the flag to indicate an ADC reference value should be stored reference_flag = 1; } void board_init(void) { // ADMUX defaults to Vcc reference with ADC0 as input // Enable ADC with prescale by 8 ADCSRA = (1<<ADEN) | (1<<ADPS1) | (1<<ADPS0); // Disable digital input on ADC0 pin. Not strictly required // but reduces power consumption a bit. DIDR0 = 0x01; PORTA = 0xFE; // enable pull-ups on PA7 - PA1 // PORTB = 0x04; // enable pull-up on PB2 (INT0) }

Getting a single value of the pin was also very noisy even when only triggered by values of 1000. So I decided to try to average across multple readouts to remove and random fluxuations. This improved the noise but it did not remove it completely.

// read four samples and then average them sample = get_ADC_sample(); sample += get_ADC_sample(); sample += get_ADC_sample(); sample += get_ADC_sample(); sample = sample >> 2; // divide by 4 to average the samples

I also tried inserting longer and longer delays between each read to see if that would completely remove it. Again, this reduced the problem, but did not remove the issue. For example, if my finger was near the board for more than a few seconds, it would trigger the DC motor.

By this time, it was getting too late and we need to integrate all the components together to have a semi working machine.

So, we first tested how well the DC motor could shake the cup. At this point Jim and Molly changed the design to replace the shaker, with a magnetic bar that would remain in the cup to mix the beverage.

This worked surprisingly well. As you can see in the below two examples.





Then, we placed it in the device and tested the lights and shaker. It works well!



Unfortunately, we did not have enough time to get everything to work together. However, as can be found on the group page, we were able to get all of the individual components to work independently at one point. Group page