Washing maching board, PIC IC replacement or other microcontroller ? - Page 1
Forum section: electronics / projects

author: nipil
author_rank: Contributor
timestamp: November 22, 2021, 02:12:59 pm
content: Hello, first project i post here, i'm asking for your view and adviceI recently disassemble a washing mashing and kept the motor/tachometer and controller board which has a PIC16C56-XTI/P ICI analyzed the board (KAREL Y26/YOC CMD1A3) and cabling and after simplifying everything, i got the running again, stillwiththe board RPM control (which i want to keep)So i'm good to go further and customize it to my needs, but I have 2 questions i cannot seem to answer myself1) Design : How much power can the "onboard DC rectifier" supply without crumbling down ?The design is as follows :According to PIC datasheet, consumption just for the IC is "less than 2mA"If i want to change the type of microcontroller, i think i should knowhow much current could i drain from that designand if/when i will have to add an external power supplyWhen probing VDD on the scope, i see that Vdd rises in approximately 20ms, and has a ripple of 1.7v when the motor is not running, and a ripple of 2.1v when the motor is running (pretty ugly, i think)2) Opinion / best practices : which strategy i should adopt to customize the board ?Of course, i will have to reimplement the inputs (modes, tachometer detection, triggering the triac, etc) but that's the software side and i'm not overly concerned so farFor the hardware i'm hesistating between :a) build a daughter board with another microcontroller, and plug it in a connector soldered in place of the PICadvantage : i could use any microtroller i know (arduino etc) so no hardware required (except perf board and connectors)drawback : fit the daughter board on the existing board, traces and solder, etcb) or replace the existing PIC with another pin-compatibe PIC (PIC16F628A-I/P for example, which i can get easily)advantage : simple "in and out"drawback : i have to learn pic programming, which i do not yet know and im up to, and have to get the necessary pic hardware/software for debugging/programming itI think it would be "more elegant" though to replace the PIC by another PICc) another solution ?From your experience, which way would you do it and for what reasons ?Thanks in advance for your insights

author: tunk
author_rank: Super Contributor
timestamp: November 22, 2021, 03:10:45 pm
content: 1) Wouldn't really know, but I think the current through R5+R23 is ~28mA (230V/8.3k).

author: jpanhalt
author_rank: Super Contributor
timestamp: November 22, 2021, 04:59:38 pm
content: The PIC 16C56 is a 12-bit core and lacks interrupts and a couple of literal instructions. The last page of its datasheet gives an overview of how to migrate to newer microcontrollers. Can you read the hex file? (likely not) Thus, if you change the MCU, you will probably have to write your own code.

author: Ian.M
author_rank: Super Contributor
timestamp: November 22, 2021, 05:08:31 pm
content: Also, that's a non-isolated PSU, so the whole MCU circuit is mains live. If you are using an Arduino, or an in-circuit PIC programmer, it only takes one moment of inattention to make the mistake of connecting it without isolating the supply, which if you are not using a USB isolator will blow the programmer, the PC's USB port and possibly the whole motherboard!BE CAREFUL!

author: nipil
author_rank: Contributor
timestamp: November 22, 2021, 05:38:38 pm
content: Quote from: Ian.M on November 22, 2021, 05:08:31 pmThanks for the reminder, that's always a good thing to note. I am quite used to working with mains and the required personnal safety/danger, and as for equipement safety, i always use differential probe for the scope when there is AC line connecter. My method for programming is to have the chip off-board (i'm using ZIF sockets everywhere when prototyping) and very exceptionnaly i use a very old laptop on battery to debug in-situ with uart. Please advise me if i'm missing anything else, i'm happy to learnQuote from: jpanhalt on November 22, 2021, 04:59:38 pmI scrolled over the datasheet of the PIC16F628A, and it seems to have interrupts on every pin, doesn't it ?I would only need 2 interrupts (on RB4 and RB5 to fit the existing boards) as both are linked to zero crossing detection circuitsQuote from: jpanhalt on November 22, 2021, 04:59:38 pmSo far, i can't : i do not have any hardware nor experience with PICs.And if i could, i guess modifying the existing assembly would take me more time than rewriting code in CPlease point me to any resource if you think i should pursue that methodology

author: jpanhalt
author_rank: Super Contributor
timestamp: November 22, 2021, 06:39:57 pm
content: Yes, the 16F628(A) has interrupts and was an advance over the 16F84. It is still an old chip. For anything new, I would suggest a 16F1xxx or later chip with enough pins. They are all 8-bit, and the newest ones (16F1xxx and later) have a few instructions that are "optimized" for C. I suspect you don't need the added peripherals, but why use an older chip?The chip on your board uses several bits for code protect in its configuration. It also requires an older programmer (e.g., PICStart Plus) than those currently available that are affordable (i.e., ICD3 or 4 and PICKit) . I would just start with a new(er) chip and my own program.

author: Ian.M
author_rank: Super Contributor
timestamp: November 22, 2021, 07:13:35 pm
content: Quote from: nipil on November 22, 2021, 05:38:38 pmCaution: unclamped ZCD circuits cause problems for newer PICs on analog-capable pins. See Microchip AppnoteTB3013.

author: nipil
author_rank: Contributor
timestamp: November 22, 2021, 07:46:52 pm
content: Quote from: jpanhalt on November 22, 2021, 06:39:57 pmI'll gladly start with anypin-compatibleand voltage-compatible PIC, which i can get for cheap. I found the 16F628 for 2€ shipping included on the web, and that seemed "good enough" : i reiterate, i have no experience whatsoever with PIC, so i may just as well be shooting in the dark, and there may well be other better optionsQuote from: Ian.M on November 22, 2021, 07:13:35 pmThanks for the link, i'll take a read while sipping my morning coffeeFor information, the ZCD on the board is done the following way :- for line signal, a simple divider with a zener diode :- for tachometer signal, using a transistor :BTW, i live in france, so line voltage is 230V AC

author: Ian.M
author_rank: Super Contributor
timestamp: November 22, 2021, 09:12:22 pm
content: The line signal circuit is dodgy for any modern PIC that has any analog function on RB3, as the Zener wont clamp negative voltages well enough and if its on the high end of its tolerance range can also be deficient for voltages exceeding Vdd. The cure is to add Schottky clamp diodes to Vdd and Vss to keep the pin voltage no more than 0.3V outside the rails, as detailed in TB3013. However it will work OK for the older generation of FLASH memory 'classic' midrange PICs that do *NOT* have ADC or analog comparator functions on that pin.The tacho circuit driving RB5 & T0CKI is fine for all PICs as-is as it cant drive outside the rails

author: jpanhalt
author_rank: Super Contributor
timestamp: November 22, 2021, 10:12:30 pm
content: From the "horses mouth":Frankly, I would consider a lot of others.

author: nipil
author_rank: Contributor
timestamp: November 24, 2021, 01:06:00 pm
content: Quote from: Ian.M on November 22, 2021, 09:12:22 pmYou say "won't clamp negative well enough" and "deficient for voltages above vdd" : where can i get information on this effect ? I always expected the diode to clamp at its Vz (within its tolerances) and Vf voltages (same) ...I read TB3013 about 3 times to be sure i got it right : if i used a more recent chip (or any chip pin with pass gates) i should add shottky diodes on that pin to VDD/VSS on my daughter board to protect ir : ok thanks i get it.BTW, just to be sure i understood how to choose the R1 resistor (from TB3013) when sensing line voltage on my daughter board with a new chip :- for positive half cycles, max line voltage is 326v, so R20 limits current to max 1.5mA and there cannot be more than that going to RB3 or through the added shottkey diodes, soin that part of the cycle, i think there is no need for an additional resistor R1- for negative half cycles, min line voltage is -326v, my VD4 is forward biased, and, thus "original" RB3 would be approximately at -324.5V ; with Ifmax=100mA for the added shottkys, R1 should be more than 3250 ohms to drop exceeding voltage and keep "new" RB3 to a safe -0.3V to 0V levelSo i'd use R1 > 4.7k, correct ?Finally, you say the "old" 16F628A does not have analog stuffon that pin:- in the datasheet i see that RA0 to RA3 can be "analog comparator input" so i presume there are pass gates on PORTA, but we do not care except if the original board was using these pins to sense the line- there are no non-cmos functions on PORTB, as i understand, so that's why you say it will work on RB3Correct ?Thanks for your time and effort, greatly appreciatedQuote from: jpanhalt on November 22, 2021, 10:12:30 pmAFAIK, this one is not pin compatible with the original PIC16C56 pinout (20 vs 18 pins + different pin locations)So, I would not be able to simply replace the existing chip on the existing board, which was my simplest ideaBut i could actually use that chip if i do a "daughter board" where i can re-trace the pins before plugging it in the existing boardSo thanks for the reference !