Showing posts with label attiny. Show all posts
Showing posts with label attiny. Show all posts

Sunday, 13 October 2013

Peristaltic Pumps

This is a quick knock up circuit I did on http://circuits.io/

The AT-Tiny uses three wires RX, TX & GND to communicate with the controller. The protocol will say which pump 1-4 and how many mL and the At-Tiny will take care of the rest. Just keep the Enable lines up, no need to for anything else as we're not changing direction or anything. I've left off the possible 4th pump as I haven't got one.

Regular pumps with flow meter

Because of varying head heights of the water storage, return from recycling, etc. issues I have chosen to use a flow meter to regulate water input. The idea being that all water input pumps can be pumping together and shut off once the required amount has been delivered. The flow meter introduces an additional complexity because the flow meter instructions say that the water speed should rise gradually and that air should be prevented from enterting the system. My pumps will be submersed so I'm not sure that will be an issue. For this discussuion that's not really an issue because that is a software problem likely to be quite simple by just modualting the control line.

The flow meter produces 1120 pulses per litre and takes a TTL supply voltage.

This circuit activates either pump, watches the flow pulses and then kills all pumps when the required flow is complete.

Wednesday, 9 October 2013

AVR signalling the NXP

The NXP code is pretty basic

#include "mbed.h"

DigitalOut led(LED1);
DigitalIn DATA(p23);

int main() {
    
    while(1) {
        led.write(0);
        while(DATA);
        led.write(1);
        while(!DATA);
    }
}

The AVR code was a bit trickier as it uses the timer interrupt. Took me a while to get my head round it

.include "TN13DEF.INC"

.org 0000   ;  reset interrupt vector
  rjmp on_reset

.org 0012   ;  timer0 overflow interrupt vector
  rjmp tim0_overflow

on_reset:
  ser r16
  out ddrb, r16 ; set the pin I/O

  ldi r16, 0b_0000_0101 ; set the clock multiplier
  out tccr0b, r16

  ldi r16, 0b_0000_010 ; turn the timer on
  out timsk0, r16

  sei ; turn on interrupts

main:
  nop ; I walk and walk, do nothing 
  rjmp main

tim0_overflow:
  ; negate portb
  in r17, portb
  com r17
  out portb, r17
  reti