AI POE 我的高球

本文介绍了一款结合人工智能和硬件的创新产品AIPOEmyHighBall,它利用ChatGPT和WiznetPicoPOE自动计算并调制高球威士忌,通过聊天机器人提供定制体验,展示了科技如何融入日常生活的娱乐环节。
摘要由CSDN通过智能技术生成
“AI POE my HighBall”融合了人工智能和硬件,可在家中轻松定制高球杯,使用 ChatGPT 聊天机器人和 Wiznet Pico POE 打造独特、便捷的体验

转发: AI POE my HighBall


项目介绍

介绍

每天晚上,我们都想在自己舒适的家中放松身心。 有时,如果没有冷饮,这种放松就无法完全实现。 在这种时刻,一杯高球威士忌是完美的选择。 然而,制作正确比例的高球杯比听起来更难,所以我决定开发一台人工智能高球杯机——你家里的私人调酒师。

由 dalle3 制作

项目背景

海波杯的魅力在于它的简单和精致的味道。 然而,实现这种简单饮料的完美混合需要精确的比例和技巧,因此我决定使用 Wiznet Pico POE 和水泵来自动化此过程。 这个想法很简单:使用人工智能计算正确的比例,并使用水泵以正确的比例混合威士忌和苏打水。

开发流程

准备材料:准备好必要的材料:Wiznet Pico POE、水泵、油管、传感器等。
设计 AI 算法:开发一个简单的 AI 算法来计算最佳的高球比例。
硬件组装:围绕 Wiznet Pico POE 搭建电路并连接水泵。
软件开发:将AI算法集成到Wiznet Pico POE中并编写代码来控制水泵。
测试和调整:使用真正的威士忌和苏打水制作高球威士忌,必要时调整比例并进行微调。


 
项目意义

这个项目将让您在家里快速轻松地享受完美的高球威士忌。 忙碌了一天之后,在舒适的家中喝一杯高杯威士忌会给您带来一点快乐。 该项目也是如何通过人工智能和硬件的融合将技术应用到日常生活中的一个很好的例子。

内容

软件

  1. ChatGPT - 它利用 ChatGPT API 创建聊天机器人。 关键是在系统:角色中给出明确的指示,以使机器人特定于您的高球域名。
  2. 为了配置 UI,我们安装 Streamlit 库并创建一个可以与用户对话的聊天机器人 UI。
  3. 它对用户与聊天机器人的对话结果进行索引,并从硬件中提取数据值。
  4. 将提取的数据发送到PicoPOE,以便硬件可以工作。

聊天机器人功能


def generate_response(client, user_input, conversations):
    # convert previous conversation history to OpenAI message format
    messages = []
    messages = [{"role": "system", "content": ins}]
    for msg in conversations:
        # add separate conversations from the user and the chatbot
        if msg.startswith("User: "):
            messages.append({"role": "user", "content": msg[len("user: "):]})
        elif msg.startswith("Chatbot: "):
            messages.append({"role": "assistant", "content": msg[len("chatbot: "):]})

    # add a message from the current user
    messages.append({"role": "user", "content": user_input})

    completion = client.chat.completions.create(
        model="gpt-4",
        messages=messages,
        temperature=0.1,
        max_tokens=500
    )
    return completion.choices[0].message.content.strip()

及时工程

<persona>
You are Louis, the friendly owner of AI BAR. 
</persona>
[instructions]
Your first greeting should be "I'm Louis, the owner of AI Bar, how can I help you"? Please say
1. set up a highball recommendation bot: "You are a bot that recommends highballs based on the mood of the day. You need to empathize with the person's mood, give them a highball recipe, specify the amount of whiskey and other ingredients in ml, and provide a message of hope."
2. Have a natural conversation: "After 2-3 natural conversations, ask them if they would like a highball recommendation."
3. Provide a highball recipe: "Based on their response, provide them with a highball recipe that matches their mood for the day, including the name of the highball and the ingredients in exact ml. The whiskey used in the highball should be based on their suggestion or a whiskey you know."
4. Provide a message of the day: "After providing the recipe, provide a message of the day that matches the person's mood."

Github

#git clone
!git clone https://github.com/wiznetmaker

#configure setting
#terminal run
Streamlit run app.py

硬件

上述项目中使用的硬件是 Pico POE 模块、pico 水泵、硅胶软管和电机驱动器。 可以根据您的口味添加威士忌和汤力水等其他成分。

购买前请考虑电机的电压能力。 我使用了便宜的电机和驱动器,因为我将其作为演示型制作。

成分

  • 树莓派 Pico
  • Wiznet Io模块(PoE模块)
  • 水泵驱动
  • 水泵
     

硬件控制代码

from usocket import socket
from machine import Pin,SPI
import network
import time

Motor_A_1 = machine.Pin(0, machine.Pin.OUT)
Motor_A_2 = machine.Pin(1, machine.Pin.OUT)
Motor_B_1 = machine.Pin(2, machine.Pin.OUT)
Motor_B_2 = machine.Pin(3, machine.Pin.OUT)
Motor_C_1 = machine.Pin(4, machine.Pin.OUT)
Motor_C_2 = machine.Pin(5, machine.Pin.OUT)

#W5x00 chip init
def w5x00_init():
    spi=SPI(0,2_000_000, mosi=Pin(19),miso=Pin(16),sck=Pin(18))
    nic = network.WIZNET5K(spi,Pin(17),Pin(20)) #spi,cs,reset pin
    nic.active(True)
    
    #None DHCP
    nic.ifconfig(('192.168.11.20','255.255.255.0','192.168.11.1','8.8.8.8'))
    
    #DHCP
    #nic.ifconfig('dhcp')
    
    print('IP address :', nic.ifconfig())
    while not nic.isconnected():
        time.sleep(1)
        print(nic.regs())
        

def Motor_ctl(ctl, delay):
    if ctl == 1:
        Motor_A_1.on()
        Motor_A_2.off()
        
    elif ctl == 2:
        Motor_B_1.on()
        Motor_B_2.off()
        
    elif ctl == 3:
        Motor_C_1.on()
        Motor_C_2.off()
    
    time.sleep(delay*1.5)
    
    Motor_A_1.off()
    Motor_A_2.off()
    Motor_B_1.off()
    Motor_B_2.off()
    Motor_C_1.off()
    Motor_C_2.off()

w5x00_init()
s = socket()
s.bind(('192.168.1.20', 5000)) #Source IP Address
s.listen(5)

conn, addr = s.accept()
print("Connect to:", conn, "address:", addr) 

try:
    while True:
        data = conn.recv(2048)
        source = data.decode('utf-8')
        print(source)
                
        Motor_ctl(1,20)
        Motor_ctl(2,60)
        Motor_ctl(3,10)

except KeyboardInterrupt:
    print("Key boardInterrput GPIO stop")
    Motor_A_1.off()
    Motor_A_2.off()
    Motor_B_1.off()
    Motor_B_2.off()
    Motor_C_1.off()
    Motor_C_2.off()

与S/W中的聊天机器人聊天后,接收到的菜谱用索引代码进行索引,并通过套接字通信将数据传送到PoE。 之后,导入的模块根据数据类型轮流依次执行。

结果

AI Highball Machine 不仅仅是一个饮料机,它还是一种将科技的便利和享受带入我们日常生活的新方式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值