Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,391
» Latest member: proelec
» Forum threads: 2,850
» Forum posts: 15,084

Full Statistics

Online Users
There are currently 230 online users.
» 1 Member(s) | 208 Guest(s)
Amazonbot, Applebot, Bytespider, Crawl, Google, PTST/240201, PetalBot, Semrush, Yandex, bot, sebfromgermany

Latest Threads
Additional GPIO
Forum: KC868-A4S
Last Post: Amaral989
3 hours ago
» Replies: 0
» Views: 2
Setup K868-a32 and k868-a...
Forum: DIY Project
Last Post: admin
6 hours ago
» Replies: 7
» Views: 43
KC868-A16 with IDE 2.3.4
Forum: KC868-A16
Last Post: admin
6 hours ago
» Replies: 4
» Views: 45
Display
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
6 hours ago
» Replies: 1
» Views: 4
RTC stop working with bu...
Forum: KC868-A6
Last Post: admin
Yesterday, 08:31 AM
» Replies: 15
» Views: 5,051
Hibrid project
Forum: KC868-Server Raspberry Pi4 local server
Last Post: Psyos
Yesterday, 12:32 AM
» Replies: 2
» Views: 13
Double press/ Long press ...
Forum: KC868-AI
Last Post: admin
03-09-2025, 11:34 PM
» Replies: 7
» Views: 427
Trigger Outputs
Forum: KC868-HxB series Smart Controller
Last Post: admin
03-09-2025, 11:29 PM
» Replies: 5
» Views: 46
Using 12v on Digital Inpu...
Forum: KC868-A16
Last Post: admin
03-09-2025, 01:31 PM
» Replies: 17
» Views: 397
Input problem 868 A6
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
03-09-2025, 01:29 PM
» Replies: 3
» Views: 18

  [arduino code examples for AS]-04 how to output dynamic wave to speaker by MAX98357A
Posted by: admin - 10-22-2024, 12:57 AM - Forum: KinCony AS - No Replies

Code:
/*
  ESP32 I2S Audio Test with Dynamic Frequency and Amplitude
  This code generates a sine wave with changing frequency and amplitude
  to test the MAX98357A amplifier output.
*/

// Include I2S driver
#include <driver/i2s.h>
#include <math.h>

// Connections to MAX98357A amplifier
#define I2S_DOUT  8
#define I2S_BCLK  7
#define I2S_LRC   6

// Use I2S Processor 0
#define I2S_PORT I2S_NUM_0

// Sample rate and initial parameters
const int sampleRate = 44100;
const float baseFrequency = 440.0;  // Base frequency (A4 note)
const int baseAmplitude = 3000;     // Base amplitude
const float frequencyStep = 5.0;    // Frequency change rate
const int amplitudeStep = 50;       // Amplitude change rate

// Variables to control dynamic frequency and amplitude
float currentFrequency = baseFrequency;
int currentAmplitude = baseAmplitude;
int direction = 1;  // To control increase or decrease of frequency and amplitude

void i2s_install() {
  // Set up I2S Processor configuration for TX only
  const i2s_config_t i2s_config = {
    .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_TX),
    .sample_rate = sampleRate,
    .bits_per_sample = i2s_bits_per_sample_t(16),
    .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
    .intr_alloc_flags = 0,
    .dma_buf_count = 8,
    .dma_buf_len = 64,
    .use_apll = false
  };

  i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
}

void i2s_setpin() {
  // Set I2S pin configuration for output (amp)
  const i2s_pin_config_t pin_config = {
    .bck_io_num = I2S_BCLK,
    .ws_io_num = I2S_LRC,
    .data_out_num = I2S_DOUT,
    .data_in_num = I2S_PIN_NO_CHANGE
  };

  i2s_set_pin(I2S_PORT, &pin_config);
}

void setup() {
  // Set up Serial Monitor
  Serial.begin(115200);
  Serial.println("Generating dynamic sine wave on MAX98357A amplifier");

  // Set up I2S
  i2s_install();
  i2s_setpin();
  i2s_start(I2S_PORT);
}

void loop() {
  // Buffer to hold the audio data
  int16_t buffer[64];

  // Generate dynamic sine wave (with changing frequency and amplitude)
  for (int i = 0; i < 64; i++) {
    // Generate sine wave with current frequency and amplitude
    float sample = sinf(2.0f * M_PI * currentFrequency * i / sampleRate);
    buffer[i] = (int16_t)(sample * currentAmplitude);  // Convert float to 16-bit integer
  }

  // Send the buffer to the I2S amplifier
  size_t bytesWritten;
  i2s_write(I2S_PORT, &buffer, sizeof(buffer), &bytesWritten, portMAX_DELAY);

  // Adjust frequency and amplitude for the next loop iteration
  currentFrequency += frequencyStep * direction;
  currentAmplitude += amplitudeStep * direction;

  // Change direction of frequency and amplitude when reaching limits
  if (currentFrequency > 880.0 || currentFrequency < 220.0) {
    direction = -direction;  // Reverse direction when frequency reaches upper or lower limit
  }
  if (currentAmplitude > 5000 || currentAmplitude < 1000) {
    direction = -direction;  // Reverse direction when amplitude reaches upper or lower limit
  }
}
arduino ino file download:
.zip   AS-Speaker-Dynamic-wave.zip (Size: 1.38 KB / Downloads: 78)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   AS-Speaker-Dynamic-wave.ino.merged.zip (Size: 192.38 KB / Downloads: 69)

Print this item

  [arduino code examples for AS]-03 how to output simple wave to speaker by MAX98357A
Posted by: admin - 10-22-2024, 12:54 AM - Forum: KinCony AS - No Replies

Code:
/*
  ESP32 I2S Audio Test
  This code generates a simple sine wave to test the MAX98357A amplifier output.
*/

// Include I2S driver
#include <driver/i2s.h>
#include <math.h>

// Connections to MAX98357A amplifier
#define I2S_DOUT  8
#define I2S_BCLK  7
#define I2S_LRC   6

// Use I2S Processor 0
#define I2S_PORT I2S_NUM_0

// Sample rate and wave parameters
const int sampleRate = 44100;
const float frequency = 440.0; // Frequency of the sine wave (A4 note)
const int amplitude = 3000;    // Amplitude of the sine wave

void i2s_install() {
  // Set up I2S Processor configuration for TX only
  const i2s_config_t i2s_config = {
    .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_TX),
    .sample_rate = sampleRate,
    .bits_per_sample = i2s_bits_per_sample_t(16),
    .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
    .intr_alloc_flags = 0,
    .dma_buf_count = 8,
    .dma_buf_len = 64,
    .use_apll = false
  };

  i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
}

void i2s_setpin() {
  // Set I2S pin configuration for output (amp)
  const i2s_pin_config_t pin_config = {
    .bck_io_num = I2S_BCLK,
    .ws_io_num = I2S_LRC,
    .data_out_num = I2S_DOUT,
    .data_in_num = I2S_PIN_NO_CHANGE
  };

  i2s_set_pin(I2S_PORT, &pin_config);
}

void setup() {
  // Set up Serial Monitor
  Serial.begin(115200);
  Serial.println("Generating sine wave on MAX98357A amplifier");

  // Set up I2S
  i2s_install();
  i2s_setpin();
  i2s_start(I2S_PORT);
}

void loop() {
  // Buffer to hold the audio data
  int16_t buffer[64];

  // Generate sine wave and write it to I2S buffer
  for (int i = 0; i < 64; i++) {
    float sample = sinf(2.0f * M_PI * frequency * i / sampleRate);
    buffer[i] = (int16_t)(sample * amplitude); // Convert float to 16-bit integer
  }

  // Send the buffer to the I2S amplifier
  size_t bytesWritten;
  i2s_write(I2S_PORT, &buffer, sizeof(buffer), &bytesWritten, portMAX_DELAY);
}
arduino ino file download:
.zip   AS-Speaker-Simple-wave.zip (Size: 1.09 KB / Downloads: 88)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   AS-Speaker-Simple-wave.ino.merged.zip (Size: 192.24 KB / Downloads: 72)

Print this item

  [arduino code examples for AS]-02 how to use INMP441 Microphone
Posted by: admin - 10-22-2024, 12:50 AM - Forum: KinCony AS - No Replies

Code:
/*
  ESP32 I2S Microphone Sample
  esp32-i2s-mic-sample.ino
  Sample sound from I2S microphone, display on Serial Plotter
  Requires INMP441 I2S microphone
*/

// Include I2S driver
#include <driver/i2s.h>

// Connections to INMP441 I2S microphone
#define I2S_WS 3
#define I2S_SD 4
#define I2S_SCK 2

// Use I2S Processor 0
#define I2S_PORT I2S_NUM_0

// Define input buffer length
#define bufferLen 64
int16_t sBuffer[bufferLen];

void i2s_install() {
  // Set up I2S Processor configuration
  const i2s_config_t i2s_config = {
    .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX),
    .sample_rate = 44100,
    .bits_per_sample = i2s_bits_per_sample_t(16),
    .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
    .intr_alloc_flags = 0,
    .dma_buf_count = 8,
    .dma_buf_len = bufferLen,
    .use_apll = false
  };

  i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
}

void i2s_setpin() {
  // Set I2S pin configuration
  const i2s_pin_config_t pin_config = {
    .bck_io_num = I2S_SCK,
    .ws_io_num = I2S_WS,
    .data_out_num = -1,
    .data_in_num = I2S_SD
  };

  i2s_set_pin(I2S_PORT, &pin_config);
}

void setup() {

  // Set up Serial Monitor
  Serial.begin(115200);
  Serial.println(" ");

  delay(1000);

  // Set up I2S
  i2s_install();
  i2s_setpin();
  i2s_start(I2S_PORT);


  delay(500);
}

void loop() {

  // False print statements to "lock range" on serial plotter display
  // Change rangelimit value to adjust "sensitivity"
  int rangelimit = 3000;
  Serial.print(rangelimit * -1);
  Serial.print(" ");
  Serial.print(rangelimit);
  Serial.print(" ");

  // Get I2S data and place in data buffer
  size_t bytesIn = 0;
  esp_err_t result = i2s_read(I2S_PORT, &sBuffer, bufferLen, &bytesIn, portMAX_DELAY);

  if (result == ESP_OK)
  {
    // Read I2S data buffer
    int16_t samples_read = bytesIn / 8;
    if (samples_read > 0) {
      float mean = 0;
      for (int16_t i = 0; i < samples_read; ++i) {
        mean += (sBuffer[i]);
      }

      // Average the data reading
      mean /= samples_read;

      // Print to serial plotter
      Serial.println(mean);
 
    }
  }
}
arduino ino file download:
.zip   INMP441.zip (Size: 1.1 KB / Downloads: 112)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   INMP441.ino.merged.zip (Size: 187.09 KB / Downloads: 91)
demo use arduino serial plotter tool to detect microphone sound.
   

Print this item

  [arduino code examples for AS]-01 internet radio
Posted by: admin - 10-22-2024, 12:39 AM - Forum: KinCony AS - No Replies

Code:
/*
  Simple Internet Radio Demo
  esp32-i2s-simple-radio.ino
  Simple ESP32 I2S radio
  Uses MAX98357 I2S Amplifier Module
  Uses ESP32-audioI2S Library - https://github.com/schreibfaul1/ESP32-audioI2S
*/

// Include required libraries
#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"

// Define I2S connections AS
#define I2S_DOUT  8
#define I2S_BCLK  7
#define I2S_LRC   6

// Create audio object
Audio audio;

// Wifi Credentials
String ssid =    "KinCony";
String password = "a12345678";

void setup() {

  // Start Serial Monitor
  Serial.begin(115200);

  // Setup WiFi in Station mode
  WiFi.disconnect();
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid.c_str(), password.c_str());

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  // WiFi Connected, print IP to serial monitor
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.println("");

  // Connect MAX98357 I2S Amplifier Module
  audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);

  // Set thevolume (0-100)
  audio.setVolume(10);

  // Connect to an Internet radio station (select one as desired)
  audio.connecttohost("http://vis.media-ice.musicradio.com/CapitalMP3");
  //audio.connecttohost("mediaserv30.live-nect MAX98357 I2S Amplifier Module
  //audio.connecttohost("www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u");
  //audio.connecttohost("stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a");
  //audio.connecttohost("www.antenne.de/webradio/antenne.m3u");
  //audio.connecttohost("0n-80s.radionetz.de:8000/0n-70s.mp3");

}

void loop()

{
  // Run audio player
  audio.loop();

}

// Audio status functions

void audio_info(const char *info) {
  Serial.print("info        "); Serial.println(info);
}
void audio_id3data(const char *info) { //id3 metadata
  Serial.print("id3data     "); Serial.println(info);
}
void audio_eof_mp3(const char *info) { //end of file
  Serial.print("eof_mp3     "); Serial.println(info);
}
void audio_showstation(const char *info) {
  Serial.print("station     "); Serial.println(info);
}
void audio_showstreaminfo(const char *info) {
  Serial.print("streaminfo  "); Serial.println(info);
}
void audio_showstreamtitle(const char *info) {
  Serial.print("streamtitle "); Serial.println(info);
}
void audio_bitrate(const char *info) {
  Serial.print("bitrate     "); Serial.println(info);
}
void audio_commercial(const char *info) { //duration in sec
  Serial.print("commercial  "); Serial.println(info);
}
void audio_icyurl(const char *info) { //homepage
  Serial.print("icyurl      "); Serial.println(info);
}
void audio_lasthost(const char *info) { //stream URL played
  Serial.print("lasthost    "); Serial.println(info);
}
void audio_eof_speech(const char *info) {
  Serial.print("eof_speech  "); Serial.println(info);
}
arduino ino file download:
.zip   internet-radio.zip (Size: 1.15 KB / Downloads: 90)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   internet-radio.ino.merged.zip (Size: 849.07 KB / Downloads: 105)
just make sure replace wifi router's ssid and password by yourself.

Print this item

  Server16 raspberry pi
Posted by: Saif Kitany - 10-21-2024, 06:28 PM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - Replies (4)

Hello kincony technical team support ,

I Have H32b controller, my question is like this:

If I purchase server16 raspberry pi iot getway, then can i by node red to control h32b with a diagram that stand on my requirements?

For example:

My h32b is to control electrical windows in my home. So i want for example to open:

1. Window number 1at 5%
2. Window number 2 at 10%
3window number 3 at 100%
.
.
.
Etc…

Print this item

  Like the A6 but more 0-10V outputs
Posted by: tarajas - 10-21-2024, 04:45 PM - Forum: Extender module - Replies (6)

Hi,

Basically none of the dev boards offerred by Kincony have more 0-10V outputs than 2, while also having SSR digital outputs, instead of mechanical relays right?

So the only way is to buy at least minimum an A6 board (it has the I2C port needed for the extenders), then use an extender right? Which extender should I go for?

For the the SSR outputs are the main focus and multiple 0-10V outputs as well.

Print this item

  How to control RGBW 5pin led strip with A16 controller
Posted by: Karnek - 10-21-2024, 08:12 AM - Forum: KC868-A16 - Replies (18)

Hi!

Can someone guide me how can I controll 5pin RGBW SMD 5050 led strip ( not addressable LEDs, total of ~25meters long, 5pcs x 5meters, 12v )

using A16 board & Home assistant ideally?




Attached Files Thumbnail(s)
   
Print this item

  Max PWM frequency
Posted by: kepten - 10-19-2024, 07:49 PM - Forum: B16M - Replies (16)

Hi, does the B16M board support dimming LEDs with 20kHz PWM (up to 10A/channel load)? If not, what is the maximum PWM frequency that can be used without overheating/burning the MOSFET/driver/microcontroller/etc?
Regards,
Robert

Print this item

  AS ESPHome yaml for home assistant
Posted by: admin - 10-19-2024, 12:09 PM - Forum: KinCony AS - Replies (20)

   

Code:
esphome:
  name: as
  friendly_name: AS
  platformio_options:
    board_build.flash_mode: dio
  on_boot:
    - light.turn_on:
        id: led_ww
        blue: 100%
        brightness: 60%
        effect: fast pulse
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      CONFIG_AUDIO_BOARD_CUSTOM: "y"
  
psram:
  mode: octal  # quad for N8R2 and octal for N16R8
  speed: 80MHz
# Enable logging
logger:
  hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
  encryption:
    key: "TFpb+pBAvQIS1MVwaA7EoJ2DkpWE+79UvVro7yMyGdU="
  on_client_connected:
        then:
          - delay: 50ms
          - light.turn_off: led_ww
          - micro_wake_word.start:
  on_client_disconnected:
        then:
          - voice_assistant.stop:
ota:
  - platform: esphome
    password: "1245211a05eef56614a2ef5a3f3e971c"
wifi:
  ssid: "KinCony"
  password: "a12345678"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-S3-Wake-Word"
    password: "LJfUrdJk3svP"
captive_portal:
button:
  - platform: restart
    name: "Restart"
    id: but_rest
switch:
  - platform: template
    id: mute
    name: mute
    optimistic: true
    on_turn_on:
      - micro_wake_word.stop:
      - voice_assistant.stop:
      - light.turn_on:
          id: led_ww          
          red: 100%
          green: 0%
          blue: 0%
          brightness: 60%
          effect: fast pulse
      - delay: 2s
      - light.turn_off:
          id: led_ww
      - light.turn_on:
          id: led_ww          
          red: 100%
          green: 0%
          blue: 0%
          brightness: 30%
    on_turn_off:
      - micro_wake_word.start:
      - light.turn_on:
          id: led_ww          
          red: 0%
          green: 100%
          blue: 0%
          brightness: 60%
          effect: fast pulse
      - delay: 2s
      - light.turn_off:
          id: led_ww
  
light:
  - platform: esp32_rmt_led_strip
    id: led_ww
    rgb_order: GRB
    pin: GPIO16
    num_leds: 1
    rmt_channel: 0
    chipset: ws2812
    name: "on board light"
    effects:
      - pulse:
      - pulse:
          name: "Fast Pulse"
          transition_length: 0.5s
          update_interval: 0.5s
          min_brightness: 0%
          max_brightness: 100%
         
         
# Audio and Voice Assistant Config         
i2s_audio:
  - id: i2s_in
    i2s_lrclk_pin: GPIO3  #WS
    i2s_bclk_pin: GPIO2 #SCK
  - id: i2s_speaker
    i2s_lrclk_pin: GPIO6  #LRC
    i2s_bclk_pin: GPIO7 #BLCK
microphone:
  - platform: i2s_audio
    id: va_mic
    adc_type: external
    i2s_din_pin: GPIO4 #SD pin on the INMP441
    channel: left
    pdm: false
    i2s_audio_id: i2s_in
    bits_per_sample: 32 bit
   
speaker:
    platform: i2s_audio
    id: va_speaker
    i2s_audio_id: i2s_speaker
    dac_type: external
    i2s_dout_pin: GPIO8   #  DIN Pin of the MAX98357A Audio Amplifier
    channel: mono
micro_wake_word:
  on_wake_word_detected:
    # then:
    - voice_assistant.start:
        wake_word: !lambda return wake_word;
    - light.turn_on:
        id: led_ww          
        red: 30%
        green: 30%
        blue: 70%
        brightness: 60%
        effect: fast pulse
  models:
    - model: github://esphome/micro-wake-word-models/models/v2/hey_jarvis.json
   
voice_assistant:
  id: va
  microphone: va_mic
  noise_suppression_level: 2.0
  volume_multiplier: 4.0
  speaker: va_speaker
  on_stt_end:
       then:
         - light.turn_off: led_ww
  on_error:
          - micro_wake_word.start: 
  on_end:
        then:
          - light.turn_off: led_ww
          - wait_until:
              not:
                voice_assistant.is_running:
          - micro_wake_word.start: 
yaml file download:
.txt   AS-HA.txt (Size: 3.94 KB / Downloads: 466)

Print this item

  AS ESP32-S3 IO pins define
Posted by: admin - 10-19-2024, 12:08 PM - Forum: KinCony AS - No Replies

433M receiver socket (reserved):GPIO18

IR receiver  GPIO1

WS2812B 3pcs bottom RGBW LEDs:GPIO15
WS2812B 1pc vertical bar RGBW LED:GPIO16

Microphone:
INMP441-WS:GPIO3
INMP441-SCK:GPIO2
INMP441-SD:GPIO4

Amplifier:
MAX98357A-LRC:GPIO6
MAX98357A-BLCK:GPIO7
MAX98357A-DIN:GPIO8

MAX98357A-SD MODE:GPIO5

SD Card (reserved on PCB)
SD_MISO:GPIO13
SD_SCK:GPIO12
SD_MOSI:GPIO11
SD_CS:GPIO10

free GPIO for DIY extend on PCB:

GPIO44,GPIO41,GPIO39,GPIO17,GPIO21,GPIO48
GPIO43,GPIO42,GPIO40,GPIO38,GPIO9,GPIO47,GPIO14

Print this item