Add unlimited field collections in a from of drupal
This is a working code that can be placed directly into your form function. Please see the comments too.

$node = new stdClass();
// Replace the value to the content type's machine name where you have added
// the field collection field
$node-&gt;type = 'CONTENT_TYPE';

// Prepare the field collection display array
$form['field_collection_display'] = array();

// Get the field collection field's info/structure and return it to the given variable
// w/c in our case is $form['field_collection_display']
field_attach_form('node', $node, $form['field_collection_display'], $form_state, NULL, array(
  'field_name' =&gt; 'FIELD_COLLECTION_FIELD_NAME'
));

$form['submit'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; 'Submit',
);

return $form;


For the "Add another item" display, when you go the the field collection's content manage field settings page it says that the button will only display when it's set to 'Unlimited' w/c isn't your requirement. So you would need to add custom validations to this.

Since this is also custom coding, if you're having a hard time manipulating the field I would also recommend looking at doing the "field collection" functionality by yourself. This is the link https://api.drupal.org/api/examples/form_example!form_example.module/group/form_example/7. You could go to the form_example_tutorial_9 directly if you want.