Fish Feeder Idea...Help Regards

Status
Not open for further replies.
Hello All,

I have to make a Fish feeder Unit with 12F675. I have just an Idea about switching with 12F675. I make a schematic for 12F675 with switch.

Can you please someone guide me to make this?

Regards Manoj Soorya

NB: I think this forum is used to post about PIC Chips. If not, Please guide me. Sorry to post here.
 
If the switch is Press and hold (My timer output is enable for 1 Minute minimum) either Press, all LED will be ON.
After 1 Second, LED 1 Turn Off,
After 2 Second, LED 2 Turn Off
After 4 Second, LED 3 Turn Off
After 6 Second, LED 4 Turn Off
After 8 Second, LED 5 Turn Off.

(5 LED is used for Manual Timer selection for the Motor will Enable..)

any hope ?

Thank you
 
Well, no one is going to code it for you but we would be glad to help if you provide an attempt. However, this project is ideal for someone. If you think it might be too much for you to handle, you could try using a PICAXE instead of a PIC. A PICAXE is just a PIC pre-loaded with an interpreter to make it easier to code for (but will run slower than coding it directly). The 8-pin PICAXE should be almost the exact, if not the exact same chip as the 12F675.

Don't forget that you have to get the code from your computer to the PIC. This normally takes a little bit of extra wires going to the PIC and a programmer box sitting between the computer and board, unless you have a way to program the chip directly before putting it into the circuit.

In your circuit though, don't you have to drive a motor of some kind? I don't see any motors. The PIC cannot drive a motor directly from it's pins (can't provide enough current). So at the very least, you need to drive a transistor with the PIC, and the transistor drives the motor.

Also, you need current limiting resistors in series for your LEDs. If you have too many LEDs on at the same time, the PIC will also not be able to drive them due to current limits. In that case, you would have to use a transistor with each LED (very similar to the motor) and drive the transistor with the PIC.
 
Last edited:
Manoj is using C compiler, so I moved this thread out of the Oshonsoft forum..
 
OK. I have already built a 24Hour Timer. Its output is minimum 1 Minute Enabled.

I have also a Stepper Motor Driver with Forward/Reverse Switch. Its working Perfect.

Schematic is Here



and this is the schematic of Timer



and the 12F675 is to connect between timer and the Motor controller Switch. (either Lefr/Right)
 
Last edited by a moderator:
I can use NE555 timer Insted of 12F675, But the manual timing selection is not possible. Thats I am trying with 12F675. The whole circuit is not only for a fish feeding. Many more applications like timer with presssission timing.
 
If the Code for 12F675 is Okey, The circuit will work 100%. I sure.
Why don't you just start by figuring out how to read an input line and writing a high or low to an output line? That's almost 70% of what you need. Just get that working with no interrupts using for loop delays until it works.

Then start to worry about using the timer peripheral to get precision timing.
 
New schematic is Upload.



Is this okey now sagor1?

I am trying to write the programme.
 
Last edited by a moderator:
Schematic looks better now. Always remember that the I/O pins are limited to 25mA each, and all I/O together are limited to 125mA total for the entire chip. Your schematic meets those limits ok, since each LED will be drawing about 10mA each...

Also remember that the internal oscillator, if not calibrated (PicKit2 can calibrate clock in a 12F675), can be a fair bit off frequency, 10% or more. Keep that in mind when writing timing loops and the LEDs turn on/off at different times than expected.

Also, if you want accurate timing, you have to read the calibration value via ASM code, and write it into OSCCAL register. See the datasheet section 9.2.5 for details
 
Last edited:
manoj soorya,

I do not completely understand the description of what you want the code to do.

This is my best guess:
Code:
MPASM  5.51                          MAIN.ASM   2-23-2018  16:59:10         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001     list n=0, c=150, r=dec
                      00002 ; File: main.asm
                      00003 ; Target: PIC12F675
                      00004 ; Created: 2018-02-23
                      00005 ; Author: Dan1138
                      00006 ;*********************************************************************
                      00007 ;                          ___ ___
                      00008 ;                   VDD ->|1  U  8|<- VSS
                      00009 ;                  LED1 <>|2     7|<> LED3
                      00010 ;                  LED2 <>|3     6|<> LED4
                      00011 ;                  SW1n ->|4     5|<> LED5
                      00012 ;                          ¯¯¯¯¯¯¯
                      00013 ;                         PIC12F675
                      00014 ;
                      00015 ;*********************************************************************
                      00016 ;
                      00017 ;  If the switch is Press and hold (My timer output is enable for 1 Minute minimum) either Press, all LED will be ON.
                      00018 ;  After 1 Second, LED 1 Turn Off,
                      00019 ;  After 2 Second, LED 2 Turn Off
                      00020 ;  After 4 Second, LED 3 Turn Off
                      00021 ;  After 6 Second, LED 4 Turn Off
                      00022 ;  After 8 Second, LED 5 Turn Off.
                      00023 ;
                      00024 ;  (5 LED is used for Manual Timer selection for the Motor will Enable..)
                      00025 ;
                      00026 ;*********************************************************************
                      00027 ; See: https://www.electro-tech-online.com/threads/fish-feeder-idea-help-regards.153045/
                      00028 ;*********************************************************************
                      00029     #include <p12f675.inc>
                      00001         LIST
                      00002
                      00003 ;==========================================================================
                      00004 ;  MPASM PIC12F675 processor include
                      00005 ;
                      00006 ;  (c) Copyright 1999-2013 Microchip Technology, All rights reserved
                      00007 ;==========================================================================
                      00008
                      00366         LIST
                      00030     errorlevel -302         ; suppress banksel warning messages
                      00031   
2007   3FC4           00032  __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _CP_OFF & _CPD_OFF
                      00033
                      00034 #define TIMER0_INTERRUPTS_PER_SECOND D'4000'
                      00035 #define LED1 GPIO,5
                      00036 #define LED2 GPIO,4
                      00037 #define LED3 GPIO,0
                      00038 #define LED4 GPIO,2
                      00039 #define LED5 GPIO,1
                      00040 #define SW1n GPIO,3
                      00041
                      00042 ISR_DATA    udata_shr  0x20
0020                  00043 WREG_save       res 1
0021                  00044 STATUS_save     res 1
                      00045
                      00046 TIMER_DATA  udata_shr
0000                  00047 IntsInOneSecond res 2
0002                  00048 Seconds         res 1
                      00049
                      00050 RESET_CODE  CODE 0x000
0000   2???           00051     goto    Start
                      00052
                      00053
                      00054 ISR_CODE    CODE 0x004
0004   00??           00055     movwf   WREG_save
0005   0803           00056     movf    STATUS,W
0006   00??           00057     movwf   STATUS_save
                      00058
0007   1A8B           00059     btfsc   INTCON,TMR0IE
0008   1D0B           00060     btfss   INTCON,TMR0IF
0009   2???           00061     goto    ISR_Exit
000A   110B           00062     bcf     INTCON,TMR0IF
000B   3009           00063     movlw   256-250+3
000C   0781           00064     addwf   TMR0,F
000D   30FF           00065     movlw   -1
000E   07??           00066     addwf   IntsInOneSecond,F
000F   1C03           00067     skpc
0010   07??           00068     addwf   IntsInOneSecond+1,F
0011   1803           00069     skpnc
0012   2???           00070     goto    ISR_Exit
0013   300F           00071     movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
0014   00??           00072     movwf   IntsInOneSecond+1
0015   309F           00073     movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
0016   00??           00074     movwf   IntsInOneSecond
0017   0A??           00075     incf    Seconds,F
                      00076
0018                  00077 ISR_Exit:
0018   08??           00078     movf    STATUS_save,W
0019   0083           00079     movwf   STATUS
001A   0E??           00080     swapf   WREG_save,F
001B   0E??           00081     swapf   WREG_save,W 
001C   0009           00082     retfie
                      00083   
                      00084 START_CODE  CODE
0000                  00085 Start:
0000   1A83           00086     btfsc   STATUS,RP0
0001   2???           00087     goto    OscillatorCalibrationFailed
0002   1683           00088     banksel OSCCAL
0003   2???           00089     call    GetOSCCAL
0004   0090           00090     movwf   OSCCAL 
0005                  00091 OscillatorCalibrationFailed:
0005   1683           00092     banksel ANSEL
0006   019F           00093     clrf    ANSEL
0007   0185           00094     clrf    TRISIO
0008   30DF           00095     movlw   B'11011111'
0009   0081           00096     movwf   OPTION_REG
000A   1283           00097     banksel INTCON
000B   018B           00098     clrf    INTCON
000C   0185           00099     clrf    GPIO
000D   3007           00100     movlw   0x07
000E   0099           00101     movwf   CMCON
000F   300F           00102     movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
0010   00??           00103     movwf   IntsInOneSecond+1
0011   309F           00104     movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
0012   00??           00105     movwf   IntsInOneSecond
0013   01??           00106     clrf    Seconds
0014   0181           00107     clrf    TMR0
0015   3009           00108     movlw   256-250+3
0016   0781           00109     addwf   TMR0,F
0017   168B           00110     bsf     INTCON,TMR0IE
0018   178B           00111     bsf     INTCON,GIE
                      00112 ;
                      00113 ;
                      00114 ;
0019                  00115 AppStart:
0019   0185           00116     clrf    GPIO
001A                  00117 AppLoop:
001A   1985           00118     btfsc   SW1n
001B   2???           00119     goto    AppLoop
001C   128B           00120     bcf     INTCON,TMR0IE
001D   300F           00121     movlw   HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
001E   00??           00122     movwf   IntsInOneSecond+1
001F   309F           00123     movlw   LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
0020   00??           00124     movwf   IntsInOneSecond
0021   01??           00125     clrf    Seconds
0022   3037           00126     movlw   B'00110111' ; LED1-5 on
0023   0085           00127     movwf   GPIO
0024   168B           00128     bsf     INTCON,TMR0IE
0025                  00129 AppTimeout:
0025   08??           00130     movf    Seconds,W
0026   3A01           00131     xorlw   D'1'
0027   1903           00132     skpnz
0028   2???           00133     goto    LED1_off
0029   3A03           00134     xorlw   D'1'^D'2'
002A   1903           00135     skpnz
002B   2???           00136     goto    LED2_off
002C   3A06           00137     xorlw   D'2'^D'4'
002D   1903           00138     skpnz
002E   2???           00139     goto    LED3_off
002F   3A02           00140     xorlw   D'4'^D'6'
0030   1903           00141     skpnz
0031   2???           00142     goto    LED4_off
0032   3A0E           00143     xorlw   D'6'^D'8'
0033   1903           00144     skpnz
0034   2???           00145     goto    LED5_off
0035   3A08           00146     xorlw   D'8'
0036   3C08           00147     sublw   D'8'
0037   1C03           00148     skpc
0038   2???           00149     goto    WaitForButtonUp
0039                  00150 CheckSwitch:
0039   1985           00151     btfsc   SW1n
003A   2???           00152     goto    AppStart
003B   2???           00153     goto    AppTimeout
                      00154 ;
                      00155 ;
                      00156 ;
003C                  00157 WaitForButtonUp:
003C   1985           00158     btfsc   SW1n
003D   2???           00159     goto    AppStart
003E   2???           00160     goto    WaitForButtonUp
                      00161 ;
                      00162 ;
                      00163 ;
003F                  00164 LED1_off:
003F   3017           00165     movlw   B'00010111' ; LED1   off
0040   0085           00166     movwf   GPIO
0041   2???           00167     goto    CheckSwitch
0042                  00168 LED2_off:
0042   3007           00169     movlw   B'00000111' ; LED1-2 off
0043   0085           00170     movwf   GPIO
0044   2???           00171     goto    CheckSwitch
0045                  00172 LED3_off:
0045   3006           00173     movlw   B'00000110' ; LED1-3 off
0046   0085           00174     movwf   GPIO
0047   2???           00175     goto    CheckSwitch
0048                  00176 LED4_off:
0048   3002           00177     movlw   B'00000010' ; LED1-4 off
0049   0085           00178     movwf   GPIO
004A   2???           00179     goto    CheckSwitch
004B                  00180 LED5_off:
004B   3000           00181     movlw   B'00000000' ; LED1-5 off
004C   0085           00182     movwf   GPIO
004D   2???           00183     goto    CheckSwitch
                      00184
                      00185 OSCCAL_CODE CODE 0x3ff
03FF                  00186 GetOSCCAL:
3FC4                  00187     end
 
Hello Dan Soze

Firstly Thank you so much the code, But I do not check it, Sorry. Just a few seconds, I saw this code. Thank you so much again.

1. Simple control stepper motor driver with speed control.
It is used to rotate a Stepper motor run in CW/CCW direction, only when the switch is pressed. The speed can Adjust.
2. In the switching section with 12F675 is used for automatic switching the stepper motor control Unit.
3. A simple timer used to set the Time to feed the fish. The output is connected to the 12F675 Switch. When the timer O/P is Enable, The 12F675 is also Enable. At the same time, The 5 Outrput of the 12F675 is also Enable. The output is connected to the Stepper Motor Driver Unit input (use only 1 input either CW/CCW) via a single pole five way Switch (SPFW Switch) or someting like that.

The reason for Selecting the Output Enable from 12F675, My timer minimum output Enable time is 1 Munite. Thats why the manual selector switch is used.

Please see my Previous Posts, I mensioned that the timer, Stepper Motor Driver and a video of another DIY automatic Fish feeder.

I like to combine the all three Unit in One...

I think you understand my Idea. Sorry for my poor English.

Will check your code tonight. Is more usefull, if you send the Hex file too, only If you dont mind.

Thank you so much
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…