The goal of this work is to create a closed-loop control system that combines continuous glucose, carbohydrates, and physiological variable readings to regulate glucose levels to treat hyperglycemia and prevent hypoglycemia, as well as a hypoglycemia early alarm module. We use an Extended Kalman filter (EKF) to estimate time-series coefficients of type 1 diabetic patient's glucose levels using a 4-variate time series data such as glucose level, insulin dose, physical activities, and food consumption. An adaptive Kalman Filter algorithm is best suitable for sensor fusion and also for real-time data, which uses the series of measurement data over the period to tend to predict the unknown variable. We proposed to provide the mealtime bolus as a prolonged bolus, with a slice of the insulin dosage delivered before food and the remainder delivered after food. Our research entails the use of a glucose monitor (CGM), physical activity monitor (accelerometer sensor), carbohydrates monitor (biosensor), an automatic insulin infusion controller that calculates the quantity of insulin to be injected, and an insulin infusion drive. Low-Power and Lossy Routing (LPLR) with 6LoWPAN are proposed for efficient routing and private networks. Our model is evaluated using the UVa/Padova simulator for 25 patients. We conducted our experiments with 25 virtual patients with a mix of all age categories. The simulator's default sample time is one minute, but we have set the 5-minute sampling time. Overall, the proposed models are good at predicting hypoglycaemic (<70 mg/dl), normal glycaemic (>70 and 180 mg/dl), and hyperglycaemic (180 mg/dl) blood sugar levels.