Jump to content
IGNORED

Artisan/Roastlogger and Amazon Dalian


Recommended Posts

  • Replies 102
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi, I currently use the Dalian (I have it since 10/2017) with Artisan, latest version. I run Artisan on a Raspberry Pi 3+ with 7" Touchscreen - in combination with an Arduino UNO with TC4+ board

In addition to the above post as promised that i would add pictures. I cannot seem to edit and add them to the post so they are here as a further reply.  Large bit is the original dalian k type g

Phil, Sorry, I will take some pictures when I finish for the day. The picture I already posted shows the original k type gland with my insert in and the new 3mm k type passing through it and the secu

Posted Images

I think the Phidgets out 1100 (5v digital IO) has a duty cycle between 1 and 0, 1 being fully on and 0 being off. Problems is 1 is not 1 second it is 20ms i.e 1 cycle at 50hz, so with a zero crossing SSR the resolution is either half cycle or full cycle. I'm looking in to how accurate that is and if I can change that now. An alternative is to refine the code so duty cycle is set to 1 for x time and test that.

EDIT:

So the PWM frequency of the 15625 hz. I've changed it to its minimum of 100hz. Output is PWM enabled. Probably the best thing to do is as I said above, set the duty cycle to 1 and run a simple script to have it switch on and off at appropriate intervals rather than try to use the duty cycle setting.

EDIT:

So testing this on a light to see if it dims is not viable. The SSR has to be on for 20ms to avoid supplying DC. It can of course skip half cycles and full cycles. So it's limited to 20ms on 10-20 ms off. That's enough for me to see a light flicker i.e it doesn't give the appearance of dimming. Ideally I'd have a way of detecting zero crossing and triggering the code a set time from the detection.

I'll attach my crappy code in case anybody else wants to set up artisan to run programs like this in the future but I'll be switching to a proportional SSR either burst first or phase angle and controlling it by supplying 0-5v or 0-10v from a 12 bit volt out Phidget that connects to a Vint hub.

Quote

from Phidget22.Phidget import *
from Phidget22.Devices.DigitalOutput import *
from Phidget22.ErrorCode import *
import time
import asyncio

ch = DigitalOutput ()
ch.openWaitForAttachment (400)

#ch.setDutyCycle(0) #setState overrides unhash for using PWM. 

ch.setFrequency(100) #PWM Frequency

frequency = ch.getFrequency() #Display PWM Frequency
print("Frequency: " + str(frequency))

async def main():
    while True: #Creates perpetual loop of main code below.
        count=0
        start_time = time.time()
        ch.setState(True) # Sets output on.
        dutyCycle = ch.getDutyCycle()
        print ("DutyCycle: " + str(dutyCycle))
        await asyncio.sleep(0.8) # Delays next off command by 800ms.
        print("--- %s seconds ---" % (time.time() - start_time))
        ch.setState(False) # Sets output off.
        dutyCycle = ch.getDutyCycle()
        print ("DutyCycle: " + str(dutyCycle))
        await asyncio.sleep(0.2) # Delays loop for 200ms seconds.
        print("--- %s seconds ---" % (time.time() - start_time))
asyncio.run(main())

The code prints a timer so you can see how long it is taking to send each command. I've tried 18ms on 2ms off and it still flickers, probably because it's actually waiting 12ms to switch it back on if the 2ms delay falls just past the zero crossing. 

Edited by Rob1
Link to post
Share on other sites

Can't edit anymore. Can make a new post though.

So while my code works with the phidget it will not work from Artisan because Artisan takes control of the Phidgets attached so my python scripts can't take control of the phidget. 

What should be possible is for code to be written as above that outputs via the 5v pin on the rPI (or another board). It should be possible to run the script from within artisan as a program via the call program function. For some reason the scripts don't all run even though they're essentially the same and the artisan command is the same, I can only assume this is because of the "wait for attachment line" which I've edited to 5000ms in the one that runs, and it's less in the others. 

To call and external python script in artisan you just need to use the call program function and write in the documentation field "python3 /path/to/directory/script.py" The 3 is in bold because it might not be 3, it could just be 'python' without any number. I haven't tested without the python line, could still work with just the directory.

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • About
    Coffee Forums UK is the UK's premier coffee forum Started in June 2008 by Glenn Watson, we now have more than 24000 mainly UK based members, and welcome more than 3000 members and visitors from around the world each day! With strategic investment and digital expertise from the Jackson Lockhart team (Tait Pollack and Adam Bateman), we are taking Coffee Forums UK to the next level, and are delighted to share the journey with you.

    New Members:
    We are often referred to as the friendliest forum on the web and we look forward to welcoming you onboard. Please read our Terms of Use. We stick by them, existing members please familiarise yourselves with them.


    Advertising

    Coffee Forums Media Kit

    Click Here To Buy Advertising Space 
    £100 p/m when paid yearly, up-to: 690000 banner impressions per month!


    Donate / Sponsor

    Get Your Supporter Badge Today (per year)

    image.png



    Coffee Forums Logo
     


×
×
  • Create New...